Page MenuHomePhabricator

PHP Notice: Undefined offset: 2
Closed, ResolvedPublic

Description

Error

message
PHP Notice: Undefined offset: 2

Details

Request ID
XbSsqApAME8AAGWAK9UAAAAE
Request URL
/w/rest.php/fr.wikipedia.org/v3/page/pagebundle/Margot_Honecker/161335158
Stack Trace
exception.trace
#0 /srv/deployment/parsoid/deploy-cache/revs/a69ec92e21cc4be117daaadef4a8fc5bf5813fcf/src/src/Wt2Html/TT/TemplateHandler.php(953): MWExceptionHandler::handleError(integer, string, string, integer, array)
#1 /srv/deployment/parsoid/deploy-cache/revs/a69ec92e21cc4be117daaadef4a8fc5bf5813fcf/src/src/Wt2Html/TT/TemplateHandler.php(761): Parsoid\Wt2Html\TT\TemplateHandler->getArgInfo(array)
#2 /srv/deployment/parsoid/deploy-cache/revs/a69ec92e21cc4be117daaadef4a8fc5bf5813fcf/src/src/Wt2Html/TT/TemplateHandler.php(1404): Parsoid\Wt2Html\TT\TemplateHandler->encapsulateTemplate(array)
#3 /srv/deployment/parsoid/deploy-cache/revs/a69ec92e21cc4be117daaadef4a8fc5bf5813fcf/src/src/Wt2Html/TT/TemplateHandler.php(1451): Parsoid\Wt2Html\TT\TemplateHandler->onTemplate(Parsoid\Tokens\SelfclosingTagTk)
#4 /srv/deployment/parsoid/deploy-cache/revs/a69ec92e21cc4be117daaadef4a8fc5bf5813fcf/src/src/Wt2Html/TT/TokenHandler.php(211): Parsoid\Wt2Html\TT\TemplateHandler->onTag(Parsoid\Tokens\SelfclosingTagTk)
#5 /srv/deployment/parsoid/deploy-cache/revs/a69ec92e21cc4be117daaadef4a8fc5bf5813fcf/src/src/Wt2Html/TokenTransformManager.php(120): Parsoid\Wt2Html\TT\TokenHandler->process(array)
#6 /srv/deployment/parsoid/deploy-cache/revs/a69ec92e21cc4be117daaadef4a8fc5bf5813fcf/src/src/Wt2Html/TokenTransformManager.php(182): Parsoid\Wt2Html\TokenTransformManager->processChunk(array)
#7 /srv/deployment/parsoid/deploy-cache/revs/a69ec92e21cc4be117daaadef4a8fc5bf5813fcf/src/src/Wt2Html/ParserPipeline.php(127): Parsoid\Wt2Html\TokenTransformManager->process(array, array)
#8 /srv/deployment/parsoid/deploy-cache/revs/a69ec92e21cc4be117daaadef4a8fc5bf5813fcf/src/src/Utils/PipelineUtils.php(110): Parsoid\Wt2Html\ParserPipeline->parse(string, array)
#9 /srv/deployment/parsoid/deploy-cache/revs/a69ec92e21cc4be117daaadef4a8fc5bf5813fcf/src/src/Config/ParsoidExtensionAPI.php(158): Parsoid\Utils\PipelineUtils::processContentInPipeline(Parsoid\Config\Env, Parsoid\Wt2Html\PageConfigFrame, string, array)
#10 /srv/deployment/parsoid/deploy-cache/revs/a69ec92e21cc4be117daaadef4a8fc5bf5813fcf/src/src/Config/ParsoidExtensionAPI.php(189): Parsoid\Config\ParsoidExtensionAPI->parseWikitextToDOM(string, array, boolean)
#11 /srv/deployment/parsoid/deploy-cache/revs/a69ec92e21cc4be117daaadef4a8fc5bf5813fcf/src/src/Ext/Cite/Ref.php(48): Parsoid\Config\ParsoidExtensionAPI->parseTokenContentsToDOM(array, string, string, array)
#12 /srv/deployment/parsoid/deploy-cache/revs/a69ec92e21cc4be117daaadef4a8fc5bf5813fcf/src/src/Wt2Html/TT/ExtensionHandler.php(137): Parsoid\Ext\Cite\Ref->toDOM(Parsoid\Config\ParsoidExtensionAPI, string, array)
#13 /srv/deployment/parsoid/deploy-cache/revs/a69ec92e21cc4be117daaadef4a8fc5bf5813fcf/src/src/Wt2Html/TT/ExtensionHandler.php(261): Parsoid\Wt2Html\TT\ExtensionHandler->onExtension(Parsoid\Tokens\SelfclosingTagTk)
#14 /srv/deployment/parsoid/deploy-cache/revs/a69ec92e21cc4be117daaadef4a8fc5bf5813fcf/src/src/Wt2Html/TT/TokenHandler.php(211): Parsoid\Wt2Html\TT\ExtensionHandler->onTag(Parsoid\Tokens\SelfclosingTagTk)
#15 /srv/deployment/parsoid/deploy-cache/revs/a69ec92e21cc4be117daaadef4a8fc5bf5813fcf/src/src/Wt2Html/TokenTransformManager.php(120): Parsoid\Wt2Html\TT\TokenHandler->process(array)
#16 /srv/deployment/parsoid/deploy-cache/revs/a69ec92e21cc4be117daaadef4a8fc5bf5813fcf/src/src/Wt2Html/TokenTransformManager.php(192): Parsoid\Wt2Html\TokenTransformManager->processChunk(array)
#17 /srv/deployment/parsoid/deploy-cache/revs/a69ec92e21cc4be117daaadef4a8fc5bf5813fcf/src/src/Wt2Html/TokenTransformManager.php(190): Parsoid\Wt2Html\TokenTransformManager->processChunkily(string, array)
#18 /srv/deployment/parsoid/deploy-cache/revs/a69ec92e21cc4be117daaadef4a8fc5bf5813fcf/src/src/Wt2Html/HTML5TreeBuilder.php(431): Parsoid\Wt2Html\TokenTransformManager->processChunkily(string, array)
#19 [internal function]: Parsoid\Wt2Html\HTML5TreeBuilder->processChunkily(string, array)
#20 /srv/deployment/parsoid/deploy-cache/revs/a69ec92e21cc4be117daaadef4a8fc5bf5813fcf/src/src/Wt2Html/DOMPostProcessor.php(895): Generator->current()
#21 /srv/deployment/parsoid/deploy-cache/revs/a69ec92e21cc4be117daaadef4a8fc5bf5813fcf/src/src/Wt2Html/ParserPipeline.php(148): Parsoid\Wt2Html\DOMPostProcessor->processChunkily(string, array)
#22 /srv/deployment/parsoid/deploy-cache/revs/a69ec92e21cc4be117daaadef4a8fc5bf5813fcf/src/src/Wt2Html/ParserPipeline.php(198): Parsoid\Wt2Html\ParserPipeline->parseChunkily(string, array)
#23 /srv/deployment/parsoid/deploy-cache/revs/a69ec92e21cc4be117daaadef4a8fc5bf5813fcf/src/src/Wt2Html/ParserPipelineFactory.php(308): Parsoid\Wt2Html\ParserPipeline->parseToplevelDoc(string, array)
#24 /srv/deployment/parsoid/deploy-cache/revs/a69ec92e21cc4be117daaadef4a8fc5bf5813fcf/src/src/WikitextContentModelHandler.php(78): Parsoid\Wt2Html\ParserPipelineFactory->parse(string)
#25 /srv/deployment/parsoid/deploy-cache/revs/a69ec92e21cc4be117daaadef4a8fc5bf5813fcf/src/src/Parsoid.php(86): Parsoid\WikitextContentModelHandler->toHTML(Parsoid\Config\Env)
#26 /srv/deployment/parsoid/deploy-cache/revs/a69ec92e21cc4be117daaadef4a8fc5bf5813fcf/src/src/Parsoid.php(113): Parsoid\Parsoid->parseWikitext(MWParsoid\Config\PageConfig, array)
#27 /srv/deployment/parsoid/deploy-cache/revs/a69ec92e21cc4be117daaadef4a8fc5bf5813fcf/src/extension/src/Rest/Handler/ParsoidHandler.php(543): Parsoid\Parsoid->wikitext2html(MWParsoid\Config\PageConfig, array, NULL)
#28 /srv/deployment/parsoid/deploy-cache/revs/a69ec92e21cc4be117daaadef4a8fc5bf5813fcf/src/extension/src/Rest/Handler/PageHandler.php(55): MWParsoid\Rest\Handler\ParsoidHandler->wt2html(Parsoid\Config\Env, array)
#29 /includes/Rest/Router.php(315): MWParsoid\Rest\Handler\PageHandler->execute()
#30 /includes/Rest/Router.php(285): MediaWiki\Rest\Router->executeHandler(MWParsoid\Rest\Handler\PageHandler)
#31 /includes/Rest/EntryPoint.php(116): MediaWiki\Rest\Router->execute(MediaWiki\Rest\RequestFromGlobals)
#32 /includes/Rest/EntryPoint.php(83): MediaWiki\Rest\EntryPoint->execute()
#33 /rest.php(31): MediaWiki\Rest\EntryPoint::main()
#34 /srv/mediawiki/w/rest.php(3): require(string)
#35 {main}
Related Gerrit Patches:

Event Timeline

ssastry created this task.Nov 1 2019, 1:51 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptNov 1 2019, 1:51 PM
ssastry triaged this task as Medium priority.Nov 1 2019, 1:51 PM
Arlolra claimed this task.Thu, Nov 14, 11:15 PM
Arlolra removed Arlolra as the assignee of this task.Fri, Nov 15, 12:24 AM
Arlolra added a subscriber: Arlolra.

I doubt this is fixed but failing to reproduce it on scandium with,

curl -L -x scandium.eqiad.wmnet:80 "http://fr.wikipedia.org/w/rest.php/fr.wikipedia.org/v3/page/html/Margot_Honecker/161335158"
curl -L -x scandium.eqiad.wmnet:80 "http://en.wikipedia.org/w/rest.php/en.wikipedia.org/v3/page/pagebundle/Wikipedia%3AVillage_pump_(technical)%2FArchive_37/393943126"
...

Of note, these two regexps seem needlessly different,

preg_match( '/^(\s*).*?(\s*)$/sD', $kSrc, $keySpaceMatch );
preg_match( '/^(\s*)[\s\S]*?(\s*)$/D', $vSrc, $valueSpaceMatch );

I see a bunch of similar errors in the parsoid-tests logstash board: https://logstash.wikimedia.org/app/kibana#/dashboard/parsoid-tests?_g=h@97fe121&_a=h@d8af28b

Specifically for the pages you list there. So, these are not crashers, but notices .. so, parsing proceeds beyond the notice .. i imagine php uses a null / or some default value there.

So, these are not crashers, but notices

Oh boy, I failed to make that distinction. Thanks! Repro with,

> php bin/parse.php --domain fr.wikipedia.org --pageName "Margot_Honecker" < /dev/null
PHP Notice:  Undefined offset: 2 ...
Arlolra claimed this task.Fri, Nov 15, 12:33 AM

The match is failing due to excessive backtracking. For example, a value is,

"Replay DOCUMENTAIRE                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     du 21/05/2016 en vidéo :"

Change 550993 had a related patch set uploaded (by Arlolra; owner: Arlolra):
[mediawiki/services/parsoid@master] Avoid excessive backtracking matching template argument spacing

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

Change 550993 merged by jenkins-bot:
[mediawiki/services/parsoid@master] Assert that template argument whitespace matching succeeds

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

ssastry closed this task as Resolved.Fri, Nov 15, 5:16 PM