Last modified: 2013-05-10 16:05:20 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T35865, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 33865 - Exception thrown in action=parse when attempting to use the title parameter without setting the text parameter
Exception thrown in action=parse when attempting to use the title parameter w...
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
API (Other open bugs)
unspecified
All All
: Unprioritized minor (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-01-21 20:27 UTC by Jeremy Postlethwaite
Modified: 2013-05-10 16:05 UTC (History)
5 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Comment 1 Jeremy Postlethwaite 2012-01-21 20:28:11 UTC
The exception:

internal_api_error_MWException

Exception Caught: Internal error in ApiResult::setElement: Bad parameter
Comment 2 Jeremy Postlethwaite 2012-01-21 20:29:15 UTC
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}
Comment 3 Jeremy Postlethwaite 2012-01-21 20:32:56 UTC
Narrowed down the request:

/w/api.php?action=parse&format=xml&title=Kanichar&prop=wikitext

This still generates the exception.
Comment 5 Sam Reed (reedy) 2012-01-21 20:51:53 UTC
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 );
			}
		}
Comment 6 Sam Reed (reedy) 2012-01-21 20:54:08 UTC
Happens on many pages, $this->text is null
Comment 7 Max Semenik 2012-01-21 21:09:28 UTC
Actually, it was broken in the very revision prop=wikitext was introduced, r81124.
Comment 8 Sam Reed (reedy) 2012-01-21 21:16:50 UTC
(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
Comment 9 Sam Reed (reedy) 2012-01-21 21:30:13 UTC
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

http://en.wikipedia.org/w/api.php?action=parse&format=xmlfm&title=FooBarLolBaz&prop=wikitext&text=﷒0
Comment 10 Sam Reed (reedy) 2012-01-21 21:36:16 UTC
r109693
Comment 11 Gerrit Notification Bot 2013-05-10 16:05:20 UTC
Related URL: https://gerrit.wikimedia.org/r/63138 (Gerrit Change I03c1fbcb0bd31dea8bd84e164104f7ced0ace449)

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links