Page MenuHomePhabricator

trim() expects parameter 1 to be string, array given
Closed, ResolvedPublic

Description

Error

MediaWiki version: 1.35.0-wmf.28

message
trim() expects parameter 1 to be string, array given

Details

Request ID
d89ec1b0-8257-11ea-86f9-3b880c08b3f0
Request URL
https://en.wikisource.org/w/rest.php/en.wikisource.org/v3/page/pagebundle/Page%3APopular_Science_Monthly_Volume_20.djvu%2F414/8069396
Stack Trace
exception.trace
#0 /srv/mediawiki/php-1.35.0-wmf.28/vendor/wikimedia/parsoid/src/Ext/ParsoidExtensionAPI.php(408): trim(array)
#1 /srv/mediawiki/php-1.35.0-wmf.28/vendor/wikimedia/parsoid/src/Ext/Poem/Poem.php(106): Wikimedia\Parsoid\Ext\ParsoidExtensionAPI->findAndUpdateArg(array, string, Closure)
#2 /srv/mediawiki/php-1.35.0-wmf.28/vendor/wikimedia/parsoid/src/Wt2Html/TT/ExtensionHandler.php(134): Wikimedia\Parsoid\Ext\Poem\Poem->toDOM(Wikimedia\Parsoid\Ext\ParsoidExtensionAPI, string, array)
#3 /srv/mediawiki/php-1.35.0-wmf.28/vendor/wikimedia/parsoid/src/Wt2Html/TT/ExtensionHandler.php(260): Wikimedia\Parsoid\Wt2Html\TT\ExtensionHandler->onExtension(Wikimedia\Parsoid\Tokens\SelfclosingTagTk)
#4 /srv/mediawiki/php-1.35.0-wmf.28/vendor/wikimedia/parsoid/src/Wt2Html/TT/TokenHandler.php(210): Wikimedia\Parsoid\Wt2Html\TT\ExtensionHandler->onTag(Wikimedia\Parsoid\Tokens\SelfclosingTagTk)
#5 /srv/mediawiki/php-1.35.0-wmf.28/vendor/wikimedia/parsoid/src/Wt2Html/TokenTransformManager.php(118): Wikimedia\Parsoid\Wt2Html\TT\TokenHandler->process(array)
#6 /srv/mediawiki/php-1.35.0-wmf.28/vendor/wikimedia/parsoid/src/Wt2Html/TokenTransformManager.php(180): Wikimedia\Parsoid\Wt2Html\TokenTransformManager->processChunk(array)
#7 /srv/mediawiki/php-1.35.0-wmf.28/vendor/wikimedia/parsoid/src/Wt2Html/ParserPipeline.php(127): Wikimedia\Parsoid\Wt2Html\TokenTransformManager->process(array, array)
#8 /srv/mediawiki/php-1.35.0-wmf.28/vendor/wikimedia/parsoid/src/Utils/PipelineUtils.php(107): Wikimedia\Parsoid\Wt2Html\ParserPipeline->parse(string, array)
#9 /srv/mediawiki/php-1.35.0-wmf.28/vendor/wikimedia/parsoid/src/Wt2Html/TT/TemplateHandler.php(619): Wikimedia\Parsoid\Utils\PipelineUtils::processContentInPipeline(Wikimedia\Parsoid\Config\Env, Wikimedia\Parsoid\Wt2Html\PageConfigFrame, string, array)
#10 /srv/mediawiki/php-1.35.0-wmf.28/vendor/wikimedia/parsoid/src/Wt2Html/TT/TemplateHandler.php(1396): Wikimedia\Parsoid\Wt2Html\TT\TemplateHandler->processTemplateSource(array, array, string)
#11 /srv/mediawiki/php-1.35.0-wmf.28/vendor/wikimedia/parsoid/src/Wt2Html/TT/TemplateHandler.php(1448): Wikimedia\Parsoid\Wt2Html\TT\TemplateHandler->onTemplate(Wikimedia\Parsoid\Tokens\SelfclosingTagTk)
#12 /srv/mediawiki/php-1.35.0-wmf.28/vendor/wikimedia/parsoid/src/Wt2Html/TT/TokenHandler.php(210): Wikimedia\Parsoid\Wt2Html\TT\TemplateHandler->onTag(Wikimedia\Parsoid\Tokens\SelfclosingTagTk)
#13 /srv/mediawiki/php-1.35.0-wmf.28/vendor/wikimedia/parsoid/src/Wt2Html/TokenTransformManager.php(118): Wikimedia\Parsoid\Wt2Html\TT\TokenHandler->process(array)
#14 /srv/mediawiki/php-1.35.0-wmf.28/vendor/wikimedia/parsoid/src/Wt2Html/TokenTransformManager.php(190): Wikimedia\Parsoid\Wt2Html\TokenTransformManager->processChunk(array)
#15 /srv/mediawiki/php-1.35.0-wmf.28/vendor/wikimedia/parsoid/src/Wt2Html/TokenTransformManager.php(188): Wikimedia\Parsoid\Wt2Html\TokenTransformManager->processChunkily(string, array)
#16 /srv/mediawiki/php-1.35.0-wmf.28/vendor/wikimedia/parsoid/src/Wt2Html/HTML5TreeBuilder.php(427): Wikimedia\Parsoid\Wt2Html\TokenTransformManager->processChunkily(string, array)
#17 [internal function]: Wikimedia\Parsoid\Wt2Html\HTML5TreeBuilder->processChunkily(string, array)
#18 /srv/mediawiki/php-1.35.0-wmf.28/vendor/wikimedia/parsoid/src/Wt2Html/DOMPostProcessor.php(899): Generator->current()
#19 /srv/mediawiki/php-1.35.0-wmf.28/vendor/wikimedia/parsoid/src/Wt2Html/ParserPipeline.php(148): Wikimedia\Parsoid\Wt2Html\DOMPostProcessor->processChunkily(string, array)
#20 /srv/mediawiki/php-1.35.0-wmf.28/vendor/wikimedia/parsoid/src/Wt2Html/ParserPipeline.php(198): Wikimedia\Parsoid\Wt2Html\ParserPipeline->parseChunkily(string, array)
#21 /srv/mediawiki/php-1.35.0-wmf.28/vendor/wikimedia/parsoid/src/Wt2Html/ParserPipelineFactory.php(290): Wikimedia\Parsoid\Wt2Html\ParserPipeline->parseToplevelDoc(string, array)
#22 /srv/mediawiki/php-1.35.0-wmf.28/vendor/wikimedia/parsoid/src/Core/WikitextContentModelHandler.php(78): Wikimedia\Parsoid\Wt2Html\ParserPipelineFactory->parse(string)
#23 /srv/mediawiki/php-1.35.0-wmf.28/vendor/wikimedia/parsoid/src/Parsoid.php(148): Wikimedia\Parsoid\Core\WikitextContentModelHandler->toDOM(Wikimedia\Parsoid\Config\Env)
#24 /srv/mediawiki/php-1.35.0-wmf.28/vendor/wikimedia/parsoid/src/Parsoid.php(180): Wikimedia\Parsoid\Parsoid->parseWikitext(MWParsoid\Config\PageConfig, array)
#25 /srv/mediawiki/php-1.35.0-wmf.28/vendor/wikimedia/parsoid/extension/src/Rest/Handler/ParsoidHandler.php(532): Wikimedia\Parsoid\Parsoid->wikitext2html(MWParsoid\Config\PageConfig, array, NULL)
#26 /srv/mediawiki/php-1.35.0-wmf.28/vendor/wikimedia/parsoid/extension/src/Rest/Handler/PageHandler.php(66): MWParsoid\Rest\Handler\ParsoidHandler->wt2html(MWParsoid\Config\PageConfig, array)
#27 /srv/mediawiki/php-1.35.0-wmf.28/includes/Rest/Router.php(353): MWParsoid\Rest\Handler\PageHandler->execute()
#28 /srv/mediawiki/php-1.35.0-wmf.28/includes/Rest/Router.php(308): MediaWiki\Rest\Router->executeHandler(MWParsoid\Rest\Handler\PageHandler)
#29 /srv/mediawiki/php-1.35.0-wmf.28/includes/Rest/EntryPoint.php(138): MediaWiki\Rest\Router->execute(MediaWiki\Rest\RequestFromGlobals)
#30 /srv/mediawiki/php-1.35.0-wmf.28/includes/Rest/EntryPoint.php(105): MediaWiki\Rest\EntryPoint->execute()
#31 /srv/mediawiki/php-1.35.0-wmf.28/rest.php(31): MediaWiki\Rest\EntryPoint::main()
#32 /srv/mediawiki/w/rest.php(3): require(string)
#33 {main}

Event Timeline

ssastry created this task.Apr 19 2020, 8:46 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptApr 19 2020, 8:46 PM
ssastry triaged this task as Medium priority.Apr 20 2020, 7:19 PM
ssastry moved this task from Needs Triage to Bugs & Crashers on the Parsoid board.
ssastry claimed this task.Apr 20 2020, 9:33 PM

This bug has existed in Parsoid/JS as well ... except that it reports the error and blithely carries along with the rest of the processing.

[subbu@earth:~/work/wmf/parsoid] node bin/parse.js --pageName 'Page:Popular_Science_Monthly_Volume_20.djvu/414' --domain en.wikisource.org --oldid 8069396 < /dev/null > /dev/null
[error/extension][enwikisource/Page:Popular_Science_Monthly_Volume_20.djvu/414?oldid=8069396] Error obj.k.toLowerCase is not a function  parsing extension token ....

Well, at least we now know that this is not a JS -> PHP porting or a Extension API refactoring bug. Just an old porting bug porting Poem to work with Parsoid.

Change 591195 had a related patch set uploaded (by Subramanya Sastry; owner: Subramanya Sastry):
[mediawiki/services/parsoid@master] Fix crasher in ParsoidExtensionAPI

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

Change 591195 merged by jenkins-bot:
[mediawiki/services/parsoid@master] Fix crasher in ParsoidExtensionAPI

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

ssastry closed this task as Resolved.Apr 21 2020, 8:14 PM

Change 592663 had a related patch set uploaded (by Subramanya Sastry; owner: Subramanya Sastry):
[mediawiki/vendor@master] Bump Parsoid to 0.12.0-a11

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

Change 592663 merged by jenkins-bot:
[mediawiki/vendor@master] Bump Parsoid to 0.12.0-a11

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