Page MenuHomePhabricator

InvalidArgumentException from line 1060 of WikiPage.php: "The supplied ParserOptions are not safe to ..."
Open, Needs TriagePublic

Description

MediaWiki	1.30.0-alpha (6baf2fb)
PHP	7.1.1 (apache2handler)
MariaDB	10.1.21-MariaDB
ICU	57.1

The following lines suddenly (1.30) start to throw "InvalidArgumentException from line 1060 of ...\includes\page\WikiPage.php: The supplied ParserOptions are not safe to cache. Fix the options or set $forceParse = true.". This wasn't an issue in 1.29 [0] or any earlier release!

$parserOptions = ParserOptions::newFromUserAndLang(
	$wgUser,
	$wgContLang
);

$filePage = new WikiFilePage( $this->getTitle() );

$filePage->getParserOutput( $parserOptions );

Why does it suddenly throw an exception? Using ParserOptions::newFromUserAndLang should not lead to an exception in a later process when evaluating the parser options!

Issue introduced with [1], and no, I cannot use ParserOptions::newCanonical (only added with 1.30) because the code has to work at least with 1.27!

PS: Seriously, could we stop for once breaking all kinds of userland code!

[0] https://github.com/wikimedia/mediawiki/blob/REL1_29/includes/page/WikiPage.php#L1056-L1062
[1] https://github.com/wikimedia/mediawiki/commit/0facbe3e3dfa4df81c01323b5f2aeacf880a1054

Event Timeline

mwjames created this task.Jul 13 2017, 4:17 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJul 13 2017, 4:17 AM
Pcj added a subscriber: Pcj.EditedApr 24 2019, 12:03 PM

This is probably related to T171813