Page MenuHomePhabricator

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

Event Timeline

aaron raised the priority of this task from to Needs Triage.
aaron updated the task description. (Show Details)
aaron added a project: Math.
aaron subscribed.

@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

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;
	}
{"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"]}

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'] );

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 assigned this task to aaron.
Jdforrester-WMF set Security to None.