Author: jpostlethwaite
Description:
When using the API sandbox, I tried to generate, with action=parse, title=Kanichar and all props selected:
An exception is thrown.
Version: unspecified
Severity: minor
Author: jpostlethwaite
Description:
When using the API sandbox, I tried to generate, with action=parse, title=Kanichar and all props selected:
An exception is thrown.
Version: unspecified
Severity: minor
Title | Reference | Author | Source Branch | Dest Branch | |
---|---|---|---|---|---|
phorge: Construct fully qualified names for milestone projects | toolforge-repos/wikibugs2!8 | bd808 | work/bd808/debugging-tools | main |
jpostlethwaite wrote:
The exception:
internal_api_error_MWException
Exception Caught: Internal error in ApiResult::setElement: Bad parameter
jpostlethwaite wrote:
The stack trace:
#0 /usr/local/apache/common-local/php-1.18/includes/api/ApiBase.php(1255): wfDebugDieBacktrace('Internal error ...')
#1 /usr/local/apache/common-local/php-1.18/includes/api/ApiResult.php(149): ApiBase::dieDebug('ApiResult::setE...', 'Bad parameter')
#2 /usr/local/apache/common-local/php-1.18/includes/api/ApiResult.php(180): ApiResult::setElement(Array, '*', NULL)
#3 /usr/local/apache/common-local/php-1.18/includes/api/ApiParse.php(282): ApiResult::setContent(Array, NULL)
#4 /usr/local/apache/common-local/php-1.18/includes/api/ApiMain.php(692): ApiParse->execute()
#5 /usr/local/apache/common-local/php-1.18/includes/api/ApiMain.php(358): ApiMain->executeAction()
#6 /usr/local/apache/common-local/php-1.18/includes/api/ApiMain.php(342): ApiMain->executeActionWithErrorHandling()
#7 /usr/local/apache/common-local/php-1.18/api.php(115): ApiMain->execute()
#8 /usr/local/apache/common-local/live-1.5/api.php(3): require('/usr/local/apac...')
#9 {main}
jpostlethwaite wrote:
Narrowed down the request:
/w/api.php?action=parse&format=xml&title=Kanichar&prop=wikitext
This still generates the exception.
Replicable on trunk (exported article and dependant pages into my dev wiki)
<?xml version="1.0"?>
<api servedby="ubuntu64-web-esxi">
<error code="internal_api_error_MWException" info="Exception Caught: Internal error in ApiResult::setElement: Bad parameter" xml:space="preserve">
#0 /home/reedy/mediawiki/trunk/phase3/includes/api/ApiBase.php(1300): wfDebugDieBacktrace('Internal error ...')
#1 /home/reedy/mediawiki/trunk/phase3/includes/api/ApiResult.php(144): ApiBase::dieDebug('ApiResult::setE...', 'Bad parameter')
#2 /home/reedy/mediawiki/trunk/phase3/includes/api/ApiResult.php(175): ApiResult::setElement(Array, '*', NULL)
#3 /home/reedy/mediawiki/trunk/phase3/includes/api/ApiParse.php(278): ApiResult::setContent(Array, NULL)
#4 /home/reedy/mediawiki/trunk/phase3/includes/api/ApiMain.php(706): ApiParse->execute()
#5 /home/reedy/mediawiki/trunk/phase3/includes/api/ApiMain.php(361): ApiMain->executeAction()
#6 /home/reedy/mediawiki/trunk/phase3/includes/api/ApiMain.php(345): ApiMain->executeActionWithErrorHandling()
#7 /home/reedy/mediawiki/trunk/phase3/api.php(117): ApiMain->execute()
#8 {main}
</error>
</api>
wikitext is indeed the bad paramter, line 278 is the $result->setContent()
if ( isset( $prop['wikitext'] ) ) { $result_array['wikitext'] = array(); $result->setContent( $result_array['wikitext'], $this->text ); if ( !is_null( $this->pstText ) ) { $result_array['psttext'] = array(); $result->setContent( $result_array['psttext'], $this->pstText ); } }
(In reply to comment #7)
Actually, it was broken in the very revision prop=wikitext was introduced,
r81124.
Trololol. I have a fix, just not sure if it's the best
Actually, you shouldn't be using Title in this case
You want page
'title' => 'Title of page the text belongs to',
'page' => "Parse the content of this page. Cannot be used together with {$p}text and {$p}title",
http://en.wikipedia.org/w/api.php?action=parse&format=xmlfm&page=Kanichar&prop=wikitext
Title is so you can "create" a page, and use that as the title against arbitary text
If you do that properly, then
Related URL: https://gerrit.wikimedia.org/r/63138 (Gerrit Change I03c1fbcb0bd31dea8bd84e164104f7ced0ace449)