Page MenuHomePhabricator

PHP Warning: array_merge(): Argument #1 is not an array in Parsoid's LanguageVariantHandler
Closed, ResolvedPublicPRODUCTION ERROR

Description

Stack Trace:

from /srv/mediawiki/php-1.38.0-wmf.17/vendor/wikimedia/parsoid/src/Wt2Html/TT/LanguageVariantHandler.php(45)
#0 [internal function]: MWExceptionHandler::handleError(integer, string, string, integer, array)
#1 /srv/mediawiki/php-1.38.0-wmf.17/vendor/wikimedia/parsoid/src/Wt2Html/TT/LanguageVariantHandler.php(45): array_merge(string, array)
#2 /srv/mediawiki/php-1.38.0-wmf.17/vendor/wikimedia/parsoid/src/Wt2Html/TT/LanguageVariantHandler.php(124): Wikimedia\Parsoid\Wt2Html\TT\LanguageVariantHandler->convertOne(Wikimedia\Parsoid\Wt2Html\TokenTransformManager, array, string, array)
#3 [internal function]: Wikimedia\Parsoid\Wt2Html\TT\LanguageVariantHandler->Wikimedia\Parsoid\Wt2Html\TT\{closure}(array)
#4 /srv/mediawiki/php-1.38.0-wmf.17/vendor/wikimedia/parsoid/src/Wt2Html/TT/LanguageVariantHandler.php(138): array_map(Closure, array)
#5 /srv/mediawiki/php-1.38.0-wmf.17/vendor/wikimedia/parsoid/src/Wt2Html/TT/LanguageVariantHandler.php(289): Wikimedia\Parsoid\Wt2Html\TT\LanguageVariantHandler->onLanguageVariant(Wikimedia\Parsoid\Tokens\TagTk)
#6 /srv/mediawiki/php-1.38.0-wmf.17/vendor/wikimedia/parsoid/src/Wt2Html/TT/TokenHandler.php(154): Wikimedia\Parsoid\Wt2Html\TT\LanguageVariantHandler->onTag(Wikimedia\Parsoid\Tokens\TagTk)
#7 /srv/mediawiki/php-1.38.0-wmf.17/vendor/wikimedia/parsoid/src/Wt2Html/TokenTransformManager.php(109): Wikimedia\Parsoid\Wt2Html\TT\TokenHandler->process(array)
#8 /srv/mediawiki/php-1.38.0-wmf.17/vendor/wikimedia/parsoid/src/Wt2Html/TokenTransformManager.php(153): Wikimedia\Parsoid\Wt2Html\TokenTransformManager->processChunk(array)
#9 /srv/mediawiki/php-1.38.0-wmf.17/vendor/wikimedia/parsoid/src/Wt2Html/TokenTransformManager.php(151): Wikimedia\Parsoid\Wt2Html\TokenTransformManager->processChunkily(string, array)
#10 /srv/mediawiki/php-1.38.0-wmf.17/vendor/wikimedia/parsoid/src/Wt2Html/TreeBuilder/TreeBuilderStage.php(487): Wikimedia\Parsoid\Wt2Html\TokenTransformManager->processChunkily(string, array)
#11 [internal function]: Wikimedia\Parsoid\Wt2Html\TreeBuilder\TreeBuilderStage->processChunkily(string, array)
#12 /srv/mediawiki/php-1.38.0-wmf.17/vendor/wikimedia/parsoid/src/Wt2Html/DOMPostProcessor.php(1041): Generator->current()
#13 /srv/mediawiki/php-1.38.0-wmf.17/vendor/wikimedia/parsoid/src/Wt2Html/ParserPipeline.php(180): Wikimedia\Parsoid\Wt2Html\DOMPostProcessor->processChunkily(string, array)
#14 /srv/mediawiki/php-1.38.0-wmf.17/vendor/wikimedia/parsoid/src/Wt2Html/ParserPipelineFactory.php(308): Wikimedia\Parsoid\Wt2Html\ParserPipeline->parseChunkily(string, array)
#15 /srv/mediawiki/php-1.38.0-wmf.17/vendor/wikimedia/parsoid/src/Core/WikitextContentModelHandler.php(106): Wikimedia\Parsoid\Wt2Html\ParserPipelineFactory->parse(string)
#16 /srv/mediawiki/php-1.38.0-wmf.17/vendor/wikimedia/parsoid/src/Parsoid.php(166): Wikimedia\Parsoid\Core\WikitextContentModelHandler->toDOM(Wikimedia\Parsoid\Config\Env)
#17 /srv/mediawiki/php-1.38.0-wmf.17/vendor/wikimedia/parsoid/src/Parsoid.php(198): Wikimedia\Parsoid\Parsoid->parseWikitext(MWParsoid\Config\PageConfig, array)
#18 /srv/mediawiki/php-1.38.0-wmf.17/vendor/wikimedia/parsoid/extension/src/Rest/Handler/ParsoidHandler.php(584): Wikimedia\Parsoid\Parsoid->wikitext2html(MWParsoid\Config\PageConfig, array, NULL)
#19 /srv/mediawiki/php-1.38.0-wmf.17/vendor/wikimedia/parsoid/extension/src/Rest/Handler/PageHandler.php(88): MWParsoid\Rest\Handler\ParsoidHandler->wt2html(MWParsoid\Config\PageConfig, array)
#20 /srv/mediawiki/php-1.38.0-wmf.17/includes/Rest/Router.php(414): MWParsoid\Rest\Handler\PageHandler->execute()
#21 /srv/mediawiki/php-1.38.0-wmf.17/includes/Rest/Router.php(338): MediaWiki\Rest\Router->executeHandler(MWParsoid\Rest\Handler\PageHandler)
#22 /srv/mediawiki/php-1.38.0-wmf.17/includes/Rest/EntryPoint.php(167): MediaWiki\Rest\Router->execute(MediaWiki\Rest\RequestFromGlobals)
#23 /srv/mediawiki/php-1.38.0-wmf.17/includes/Rest/EntryPoint.php(132): MediaWiki\Rest\EntryPoint->execute()
#24 /srv/mediawiki/php-1.38.0-wmf.17/rest.php(31): MediaWiki\Rest\EntryPoint::main()
#25 /srv/mediawiki/w/rest.php(3): require(string)
#26 {main}

Details

Request URL
https://zh.wikibooks.org/w/rest.php/zh.wikibooks.org/v3/page/pagebundle/Template%3A%40/165747

Event Timeline

Related exceptions:

PHP Notice:  Undefined property: Wikimedia\Parsoid\NodeData\DataParsoid::$tsr in /home/subbu/work/wmf/parsoid/src/Wt2Html/TT/LanguageVariantHandler.php on line 104
PHP Warning:  array_merge(): Expected parameter 1 to be an array, string given in /home/subbu/work/wmf/parsoid/src/Wt2Html/TT/LanguageVariantHandler.php on line 45
PHP Fatal error:  Uncaught TypeError: Argument 1 passed to Wikimedia\Parsoid\Wt2Html\TokenTransformManager::processChunk() must be of the type array, null given, called in /home/subbu/work/wmf/parsoid/src/Wt2Html/TokenTransformManager.php on line 143 and defined in /home/subbu/work/wmf/parsoid/src/Wt2Html/TokenTransformManager.php:90

Looking at the first one, this looks a different version of T299185 where an unexpanded langvariant token makes it to the HTML Treebuilder which then trips things up later. This is an old bug that is being exposed by Tim's treebuilder updates.

Look at the language-variant SelfclosingTagTk that makes it to the HTML tree builders stage of parser pipeline id 7 below.

[subbu@earth:~/work/wmf/parsoid] php bin/parse.php --domain zh.wikibooks.org --pageName 'Template:@' --trace html < /dev/null
3-[HTML]       | "创建"
3-[HTML]       | {"type":"EOFTk"}
4-[HTML]       | "建立"
4-[HTML]       | {"type":"EOFTk"}
5-[HTML]       | "文档"
5-[HTML]       | {"type":"EOFTk"}
6-[HTML]       | "文件"
6-[HTML]       | {"type":"EOFTk"}
7-[HTML]       | {"type":"SelfclosingTagTk","name":"language-variant","attribs":[],"dataAttribs":{"tmp":{"tagId":1,"bits":0},"tsr":[590,625],"src":"-{zh-hans:创建; zh-hant:建立;}-","flags":["$S"],"variants":[],"original":[],"flagSp":[],"texts":[{"twoway":true,"lang":"zh-hans","text":"mw:lv0","sp":["","",""]},{"twoway":true,"lang":"zh-hant","text":"mw:lv1","sp":[" ","",""]},{"semi":true,"sp":""}],"a":{"mw:lv0":null,"mw:lv1":null},"sa":{"mw:lv0":"创建","mw:lv1":"建立"}}}
7-[HTML]       | {"type":"EOFTk"}
10-[HTML]      | {"type":"SelfclosingTagTk","name":"meta","attribs":[{"k":"typeof","v":"mw:Param"},{"k":"about","v":"#mwt3"}],"dataAttribs":{"tmp":{"tagId":1,"bits":0,"tplarginfo":{"targetWt":"1","func":null,"href":null,"paramInfos":{"1":{"k":"1"}}}},"tsr":[19,29],"src":"{{{1|15}}}"}}
10-[HTML]      | "15"
10-[HTML]      | {"type":"SelfclosingTagTk","name":"meta","attribs":[{"k":"typeof","v":"mw:Param/End"},{"k":"about","v":"#mwt3"}],"dataAttribs":{"tmp":{"tagId":2,"bits":0},"tsr":[null,29]}}
10-[HTML]      | "px"
10-[HTML]      | {"type":"EOFTk"}
11-[HTML]      | {"type":"TagTk","name":"span","attribs":[{"k":"typeof","v":"mw:Entity"}],"dataAttribs":{"tmp":{"tagId":1,"bits":0},"src":"&nbsp;","srcContent":" ","tsr":[32,32]}}
11-[HTML]      | " "
11-[HTML]      | {"type":"EndTagTk","name":"span","attribs":[],"dataAttribs":{"tmp":{"tagId":null,"bits":0},"tsr":[38,38]}}
11-[HTML]      | "- at -"
11-[HTML]      | {"type":"TagTk","name":"span","attribs":[{"k":"typeof","v":"mw:Entity"}],"dataAttribs":{"tmp":{"tagId":2,"bits":0},"src":"&nbsp;","srcContent":" ","tsr":[44,44]}}
11-[HTML]      | " "
11-[HTML]      | {"type":"EndTagTk","name":"span","attribs":[],"dataAttribs":{"tmp":{"tagId":null,"bits":0},"tsr":[50,50]}}
11-[HTML]      | {"type":"EOFTk"}
PHP Notice:  Undefined property: Wikimedia\Parsoid\NodeData\DataParsoid::$tsr in /home/subbu/work/wmf/parsoid/src/Wt2Html/TT/LanguageVariantHandler.php on line 104
PHP Warning:  array_merge(): Expected parameter 1 to be an array, string given in /home/subbu/work/wmf/parsoid/src/Wt2Html/TT/LanguageVariantHandler.php on line 45
PHP Fatal error:  Uncaught TypeError: Argument 1 passed to Wikimedia\Parsoid\Wt2Html\TokenTransformManager::processChunk() must be of the type array, null given, called in /home/subbu/work/wmf/parsoid/src/Wt2Html/TokenTransformManager.php on line 143 and defined in /home/subbu/work/wmf/parsoid/src/Wt2Html/TokenTransformManager.php:90
Stack trace:
#0 /home/subbu/work/wmf/parsoid/src/Wt2Html/TokenTransformManager.php(143): Wikimedia\Parsoid\Wt2Html\TokenTransformManager->processChunk()
#1 /home/subbu/work/wmf/parsoid/src/Wt2Html/ParserPipeline.php(140): Wikimedia\Parsoid\Wt2Html\TokenTransformManager->process()
#2 /home/subbu/work/wmf/parsoid/src/Utils/PipelineUtils.php(105): Wikimedia\Parsoid\Wt2Html\ParserPipeline->parse()
#3 /home/subbu/work/wmf/parsoid/src/Wt2Html/TT/LanguageVariantHandler.php(47): Wikimedia\Parsoid\Utils\PipelineUtils::processContentInPipeline()
#4 /home/subbu/work/wmf/parsoid/src/Wt2Html/TT/LanguageVariantHandler.php(124): Wikimedia\Parsoid\Wt2Html\TT\LanguageVariantHandler->convertOne()
#5 [internal funct in /home/subbu/work/wmf/parsoid/src/Wt2Html/TokenTransformManager.php on line 90

Change 755039 had a related patch set uploaded (by Subramanya Sastry; author: Subramanya Sastry):

[mediawiki/services/parsoid@master] WIP: Ensure tokens are always fully processed

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

Change 755039 merged by jenkins-bot:

[mediawiki/services/parsoid@master] WikiLinkHandler: Reprocess incorrect tokens to the right stage

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

Change 756638 had a related patch set uploaded (by Sbailey; author: Sbailey):

[mediawiki/vendor@master] Bump Parsoid to 0.15.0-a17

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

Change 756638 merged by jenkins-bot:

[mediawiki/vendor@master] Bump Parsoid to 0.15.0-a17

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

ssastry claimed this task.