Page MenuHomePhabricator

PHP Notice: Undefined index: start
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error
normalized_message
[{reqId}] {exception_url}   PHP Notice: Undefined index: start
exception.trace
from /srv/mediawiki/php-1.40.0-wmf.8/vendor/wikimedia/parsoid/src/Wt2Html/PP/Processors/MigrateTemplateMarkerMetas.php(53)
#0 /srv/mediawiki/php-1.40.0-wmf.8/vendor/wikimedia/parsoid/src/Wt2Html/PP/Processors/MigrateTemplateMarkerMetas.php(53): MWExceptionHandler::handleError(integer, string, string, integer, array)
#1 /srv/mediawiki/php-1.40.0-wmf.8/vendor/wikimedia/parsoid/src/Wt2Html/PP/Processors/MigrateTemplateMarkerMetas.php(143): Wikimedia\Parsoid\Wt2Html\PP\Processors\MigrateTemplateMarkerMetas->migrateLastChild(Wikimedia\Parsoid\DOM\Element)
#2 /srv/mediawiki/php-1.40.0-wmf.8/vendor/wikimedia/parsoid/src/Wt2Html/PP/Processors/MigrateTemplateMarkerMetas.php(113): Wikimedia\Parsoid\Wt2Html\PP\Processors\MigrateTemplateMarkerMetas->doMigrate(Wikimedia\Parsoid\DOM\Element, Wikimedia\Parsoid\Config\Env)
#3 /srv/mediawiki/php-1.40.0-wmf.8/vendor/wikimedia/parsoid/src/Wt2Html/PP/Processors/MigrateTemplateMarkerMetas.php(173): Wikimedia\Parsoid\Wt2Html\PP\Processors\MigrateTemplateMarkerMetas->doMigrate(Wikimedia\Parsoid\DOM\DocumentFragment, Wikimedia\Parsoid\Config\Env)
#4 /srv/mediawiki/php-1.40.0-wmf.8/vendor/wikimedia/parsoid/src/Wt2Html/DOMPostProcessor.php(157): Wikimedia\Parsoid\Wt2Html\PP\Processors\MigrateTemplateMarkerMetas->run(Wikimedia\Parsoid\Config\Env, Wikimedia\Parsoid\DOM\DocumentFragment, array, boolean)
#5 /srv/mediawiki/php-1.40.0-wmf.8/vendor/wikimedia/parsoid/src/Wt2Html/DOMPostProcessor.php(850): Wikimedia\Parsoid\Wt2Html\DOMPostProcessor->Wikimedia\Parsoid\Wt2Html\{closure}(Wikimedia\Parsoid\DOM\DocumentFragment, array, boolean)
#6 /srv/mediawiki/php-1.40.0-wmf.8/vendor/wikimedia/parsoid/src/Wt2Html/DOMPostProcessor.php(891): Wikimedia\Parsoid\Wt2Html\DOMPostProcessor->doPostProcess(Wikimedia\Parsoid\DOM\DocumentFragment)
#7 /srv/mediawiki/php-1.40.0-wmf.8/vendor/wikimedia/parsoid/src/Wt2Html/ParserPipeline.php(140): Wikimedia\Parsoid\Wt2Html\DOMPostProcessor->process(Wikimedia\Parsoid\DOM\DocumentFragment, array)
#8 /srv/mediawiki/php-1.40.0-wmf.8/vendor/wikimedia/parsoid/src/Utils/PipelineUtils.php(106): Wikimedia\Parsoid\Wt2Html\ParserPipeline->parse(array, array)
#9 /srv/mediawiki/php-1.40.0-wmf.8/vendor/wikimedia/parsoid/src/Utils/PipelineUtils.php(147): Wikimedia\Parsoid\Utils\PipelineUtils::processContentInPipeline(Wikimedia\Parsoid\Config\Env, Wikimedia\Parsoid\Wt2Html\PageConfigFrame, array, array)
#10 /srv/mediawiki/php-1.40.0-wmf.8/vendor/wikimedia/parsoid/src/Utils/PipelineUtils.php(185): Wikimedia\Parsoid\Utils\PipelineUtils::expandValueToDOM(Wikimedia\Parsoid\Config\Env, Wikimedia\Parsoid\Wt2Html\PageConfigFrame, array, boolean, boolean)
#11 /srv/mediawiki/php-1.40.0-wmf.8/vendor/wikimedia/parsoid/src/Wt2Html/TT/AttributeExpander.php(589): Wikimedia\Parsoid\Utils\PipelineUtils::expandValuesToDOM(Wikimedia\Parsoid\Config\Env, Wikimedia\Parsoid\Wt2Html\PageConfigFrame, array, boolean, boolean)
#12 /srv/mediawiki/php-1.40.0-wmf.8/vendor/wikimedia/parsoid/src/Wt2Html/TT/AttributeExpander.php(636): Wikimedia\Parsoid\Wt2Html\TT\AttributeExpander->buildExpandedAttrs(Wikimedia\Parsoid\Tokens\TagTk, array)
#13 /srv/mediawiki/php-1.40.0-wmf.8/vendor/wikimedia/parsoid/src/Wt2Html/TT/AttributeExpander.php(691): Wikimedia\Parsoid\Wt2Html\TT\AttributeExpander->processComplexAttributes(Wikimedia\Parsoid\Tokens\TagTk)
#14 /srv/mediawiki/php-1.40.0-wmf.8/vendor/wikimedia/parsoid/src/Wt2Html/TT/TokenHandler.php(159): Wikimedia\Parsoid\Wt2Html\TT\AttributeExpander->onAny(Wikimedia\Parsoid\Tokens\TagTk)
#15 /srv/mediawiki/php-1.40.0-wmf.8/vendor/wikimedia/parsoid/src/Wt2Html/TokenTransformManager.php(132): Wikimedia\Parsoid\Wt2Html\TT\TokenHandler->process(array)
#16 /srv/mediawiki/php-1.40.0-wmf.8/vendor/wikimedia/parsoid/src/Wt2Html/TokenTransformManager.php(195): Wikimedia\Parsoid\Wt2Html\TokenTransformManager->processChunk(array)
#17 /srv/mediawiki/php-1.40.0-wmf.8/vendor/wikimedia/parsoid/src/Wt2Html/TokenTransformManager.php(193): Wikimedia\Parsoid\Wt2Html\TokenTransformManager->processChunkily(string, array)
#18 /srv/mediawiki/php-1.40.0-wmf.8/vendor/wikimedia/parsoid/src/Wt2Html/TreeBuilder/TreeBuilderStage.php(497): Wikimedia\Parsoid\Wt2Html\TokenTransformManager->processChunkily(string, array)
#19 [internal function]: Wikimedia\Parsoid\Wt2Html\TreeBuilder\TreeBuilderStage->processChunkily(string, array)
#20 /srv/mediawiki/php-1.40.0-wmf.8/vendor/wikimedia/parsoid/src/Wt2Html/DOMPostProcessor.php(905): Generator->current()
#21 /srv/mediawiki/php-1.40.0-wmf.8/vendor/wikimedia/parsoid/src/Wt2Html/ParserPipeline.php(180): Wikimedia\Parsoid\Wt2Html\DOMPostProcessor->processChunkily(string, array)
#22 /srv/mediawiki/php-1.40.0-wmf.8/vendor/wikimedia/parsoid/src/Wt2Html/ParserPipelineFactory.php(299): Wikimedia\Parsoid\Wt2Html\ParserPipeline->parseChunkily(string, array)
#23 /srv/mediawiki/php-1.40.0-wmf.8/vendor/wikimedia/parsoid/src/Wikitext/ContentModelHandler.php(123): Wikimedia\Parsoid\Wt2Html\ParserPipelineFactory->parse(string)
#24 /srv/mediawiki/php-1.40.0-wmf.8/vendor/wikimedia/parsoid/src/Parsoid.php(172): Wikimedia\Parsoid\Wikitext\ContentModelHandler->toDOM(Wikimedia\Parsoid\Ext\ParsoidExtensionAPI)
#25 /srv/mediawiki/php-1.40.0-wmf.8/vendor/wikimedia/parsoid/src/Parsoid.php(210): Wikimedia\Parsoid\Parsoid->parseWikitext(MediaWiki\Parser\Parsoid\Config\PageConfig, ParserOutput, array)
#26 /srv/mediawiki/php-1.40.0-wmf.8/includes/Rest/Handler/ParsoidHandler.php(781): Wikimedia\Parsoid\Parsoid->wikitext2html(MediaWiki\Parser\Parsoid\Config\PageConfig, array, NULL, ParserOutput)
#27 /srv/mediawiki/php-1.40.0-wmf.8/vendor/wikimedia/parsoid/extension/src/Rest/Handler/PageHandler.php(92): MediaWiki\Rest\Handler\ParsoidHandler->wt2html(MediaWiki\Parser\Parsoid\Config\PageConfig, array)
#28 /srv/mediawiki/php-1.40.0-wmf.8/includes/Rest/Router.php(487): MWParsoid\Rest\Handler\PageHandler->execute()
#29 /srv/mediawiki/php-1.40.0-wmf.8/includes/Rest/Router.php(406): MediaWiki\Rest\Router->executeHandler(MWParsoid\Rest\Handler\PageHandler)
#30 /srv/mediawiki/php-1.40.0-wmf.8/includes/Rest/EntryPoint.php(170): MediaWiki\Rest\Router->execute(MediaWiki\Rest\RequestFromGlobals)
#31 /srv/mediawiki/php-1.40.0-wmf.8/includes/Rest/EntryPoint.php(135): MediaWiki\Rest\EntryPoint->execute()
#32 /srv/mediawiki/php-1.40.0-wmf.8/rest.php(31): MediaWiki\Rest\EntryPoint::main()
#33 /srv/mediawiki/w/rest.php(3): require(string)
#34 {main}
Impact
Notes

Details

Request URL
https://en.wikipedia.org/w/rest.php/en.wikipedia.org/v3/page/pagebundle/User%3AXihuayu2010/545025464

Event Timeline

This took me a long time to nail down but this can be reproduced with this simplified broken wikitext:

{| <span>{{1x|a}}</span> {{1x|1=k=  
v}}
|}

This is an edge case in the AttributeExpander and the bug requires the two transclusions in table attribute position with one of them being a k=v and it also needs a newline break there and it requires the first transcluion to be embedded in the HTML tag such that the closing meta tag is the last child of that html tag. The bug manifests because of how the output from AttributeExpander ends up interacting with the MigrateTemplateMetas pass where the start / end meta tags are processed out of order.

This is a weird edge case and there are a number of different ways this can be fixed.

But, ultimately, the AttributeExpander needs to be re-thought at some point since this is an outcome of circa-2012 decisions some of which are probably not relevant anymore. I might file a tech debt phab task once I am done with this task.

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

[mediawiki/services/parsoid@master] Fix bad assumption in AttributeExpander:splitTokens

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

Change 854140 merged by jenkins-bot:

[mediawiki/services/parsoid@master] Fix bad assumption in AttributeExpander:splitTokens

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

Change 861464 had a related patch set uploaded (by Arlolra; author: Arlolra):

[mediawiki/vendor@master] Bump parsoid to 0.17.0-a7

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

Change 861464 merged by jenkins-bot:

[mediawiki/vendor@master] Bump parsoid to 0.17.0-a7

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

Change 861472 had a related patch set uploaded (by C. Scott Ananian; author: Arlolra):

[mediawiki/vendor@wmf/1.40.0-wmf.12] Bump parsoid to 0.17.0-a7

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

Change 861472 merged by jenkins-bot:

[mediawiki/vendor@wmf/1.40.0-wmf.12] Bump parsoid to 0.17.0-a7

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