Page MenuHomePhabricator

Call to a member function getIsPreview() on a non-object (NULL)
Closed, ResolvedPublic

Details

Related Gerrit Patches:

Event Timeline

aaron created this task.Oct 22 2015, 1:17 AM
aaron raised the priority of this task from to Needs Triage.
aaron updated the task description. (Show Details)
aaron added a project: Math.
aaron added a subscriber: aaron.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptOct 22 2015, 1:17 AM

@aaron: Can you copy one of the error messages. I can not follow the link. I wonder when the specialpage with mode=png is used

aaron added a comment.Oct 22 2015, 5:32 PM

Looks like it is in the Graph extension handling a Math hook.

	public static function onParserAfterParse( Parser $parser ) {
		self::finalizeParserOutput( $parser->getOutput(), $parser->getTitle(),
			$parser->getOptions()->getIsPreview() );
		return true;
	}
aaron added a comment.Oct 22 2015, 5:58 PM
{"file":"/srv/mediawiki/php-1.27.0-wmf.2/includes/Hooks.php","line":204,"function":"onParserAfterParse","class":"Graph\\Singleton","type":"::","args":["Parser"]}, {"file":"/srv/mediawiki/php-1.27.0-wmf.2/extensions/Math/MathTexvc.php","line":398,"function":"run","class":"Hooks","type":"::","args":["string","array"]}, {"file":"/srv/mediawiki/php-1.27.0-wmf.2/extensions/Math/SpecialMathShowImage.php","line":102,"function":"getPng","class":"MathTexvc","type":"->","args":[]}, {"file":"/srv/mediawiki/php-1.27.0-wmf.2/includes/specialpage/SpecialPage.php","line":384,"function":"execute","class":"SpecialMathShowImage","type":"->","args":["NULL"]}, {"file":"/srv/mediawiki/php-1.27.0-wmf.2/includes/specialpage/SpecialPageFactory.php","line":553,"function":"run","class":"SpecialPage","type":"->","args":["NULL"]}, {"file":"/srv/mediawiki/php-1.27.0-wmf.2/includes/MediaWiki.php","line":249,"function":"executePath","class":"SpecialPageFactory","type":"::","args":["Title","RequestContext"]}, {"file":"/srv/mediawiki/php-1.27.0-wmf.2/includes/MediaWiki.php","line":662,"function":"performRequest","class":"MediaWiki","type":"->","args":[]}, {"file":"/srv/mediawiki/php-1.27.0-wmf.2/includes/MediaWiki.php","line":475,"function":"main","class":"MediaWiki","type":"->","args":[]}, {"file":"/srv/mediawiki/php-1.27.0-wmf.2/index.php","line":41,"function":"run","class":"MediaWiki","type":"->","args":[]}, {"file":"/srv/mediawiki/w/index.php","line":3,"function":"include","args":["string"]}
aaron added a comment.EditedOct 22 2015, 6:04 PM

Is the bizzare code below just trying to trigger a file save?

$parser = new Parser();
$text = '';
$stripState = new StripState( '' );
Hooks::run( 'ParserAfterParse', array( &$parser, &$text, &$stripState ) );

It fires a hook without startParse() getting called presumable, so mOptions is not set. Maybe the code can just call hook closure directly, e.g.:

call_user_func( $wgHooks['ParserAfterParse']['FlushMathBackend'] );
aaron added a comment.Oct 22 2015, 8:11 PM

Actually I'm not sure how that code works at all now. If it wants to flush the writes now, then there must have been some pending ones, in which case $wgHooks['ParserAfterParse']['FlushMathBackend'] would *be* set, not *unset*...

Change 248240 had a related patch set uploaded (by Aaron Schulz):
Fix "Call to a member function getIsPreview() on a non-object (NULL)"

https://gerrit.wikimedia.org/r/248240

Change 248240 merged by jenkins-bot:
Fix "Call to a member function getIsPreview() on a non-object (NULL)"

https://gerrit.wikimedia.org/r/248240

Jdforrester-WMF closed this task as Resolved.Nov 25 2015, 3:49 AM
Jdforrester-WMF assigned this task to aaron.
Jdforrester-WMF set Security to None.
Restricted Application added a subscriber: StudiesWorld. · View Herald TranscriptNov 25 2015, 3:49 AM