Steps to replicate the issue (include links if applicable):
- Enable server-side error logging in MediaWiki ($wgDebugLogFile is sufficient). Make sure parser cache is configured.
- Start an edit (does not matter whether to a new or an existing page) to a wikitext page. Add an invalid array function call that produces an error, for example {{#af_range:}} (as is).
- Save the edit.
What happens?:
An exception is thrown when saving render data into the ParserCache. This is due to ArrayFunctionInvoker::handleError storing a Message object in the ParserOutput's extension data (the ArrayFunctions__error key specifically). Message objects are not directly serialisable and need to be either converted into a string (but then this value becomes inherently non-localisable), or stored as a key and parameters combination.
This exception is not user-visible due to cache saving being deferred, but gets logged into the error log. Example exception details:
{
"@version": 1,
"host": "REDACTED",
"message": "Unable to serialize JSON",
"type": "mediawiki",
"channel": "ParserCache",
"level": "ERROR",
"monolog_level": 400,
"wiki": "internaltest_en",
"mwversion": "1.43.1",
"reqId": "6d5404044540ee4d890ef961",
"name": "pcache",
"cache_key": "internaltest_en:pcache:idhash:376-0!canonical",
"ex_message": "Unable to serialize JSON: MediaWiki\\Message\\Message",
"details": "$.ExtensionData.ArrayFunctions__error_jd72jtL0iEJbeqGXxf: MediaWiki\\Message\\Message",
"trace": "#0 /srv/mw/1.43/includes/parser/ParserCache.php(721): MediaWiki\\Json\\JsonCodec->serialize()\n#1 /srv/mw/1.43/includes/parser/ParserCache.php(580): MediaWiki\\Parser\\ParserCache->convertForCache()\n#2 /srv/mw/1.43/includes/poolcounter/PoolWorkArticleViewCurrent.php(132): MediaWiki\\Parser\\ParserCache->save()\n#3 /srv/mw/1.43/includes/poolcounter/PoolCounterWork.php(171): MediaWiki\\PoolCounter\\PoolWorkArticleViewCurrent->doWork()\n#4 /srv/mw/1.43/includes/page/ParserOutputAccess.php(362): MediaWiki\\PoolCounter\\PoolCounterWork->execute()\n#5 /srv/mw/1.43/includes/page/Article.php(828): MediaWiki\\Page\\ParserOutputAccess->getParserOutput()\n#6 /srv/mw/1.43/includes/page/Article.php(547): Article->generateContentOutput()\n#7 /srv/mw/1.43/includes/actions/ViewAction.php(78): Article->view()\n#8 /srv/mw/1.43/includes/actions/ActionEntryPoint.php(736): ViewAction->show()\n#9 /srv/mw/1.43/includes/actions/ActionEntryPoint.php(510): MediaWiki\\Actions\\ActionEntryPoint->performAction()\n#10 /srv/mw/1.43/includes/actions/ActionEntryPoint.php(146): MediaWiki\\Actions\\ActionEntryPoint->performRequest()\n#11 /srv/mw/1.43/includes/MediaWikiEntryPoint.php(200): MediaWiki\\Actions\\ActionEntryPoint->execute()\n#12 /srv/mw/1.43/index.php(58): MediaWiki\\MediaWikiEntryPoint->run()\n#13 /srv/mw/bootstrap/index.php(3): require('/srv/mw/1.43/in...')\n#14 {main}"
}This can be alternatively observed by the cache timestamp in the parser profiler/limit report changing on every page reload despite a long cache expiry.
What should have happened instead?:
Parser cache saves successfully.
Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia):
MediaWiki 1.43.1, using ArrayFunctions v1.16.1 (7ed1ed08b11b4388dce3eb0a4d57205b0c503046)
Other information (browser name/version, screenshots, etc.):