Page MenuHomePhabricator

DiscussionTools: Error: Cannot use object of type stdClass as array
Open, Stalled, Needs TriagePublicPRODUCTION ERROR

Description

Error
  • mwversion: 1.47.0-wmf.7
  • timestamp: 2026-06-18T10:20:39.816Z
  • phpversion: 8.3.31
  • reqId: 173fb78a-62ce-43af-9646-56e765fe2332
  • Find reqId in Logstash
normalized_message
[{reqId}] {exception_url}   Error: Cannot use object of type stdClass as array
FrameLocationCall
from/srv/mediawiki/php-1.47.0-wmf.7/extensions/DiscussionTools/includes/CommentFormatter.php(118)
#0/srv/mediawiki/php-1.47.0-wmf.7/extensions/DiscussionTools/includes/CommentFormatter.php(161)MediaWiki\Extension\DiscussionTools\CommentFormatter::isHtmlHeading(Wikimedia\Parsoid\DOM\Element, MediaWiki\Parser\ParserOutput)
#1/srv/mediawiki/php-1.47.0-wmf.7/extensions/DiscussionTools/includes/CommentFormatter.php(378)MediaWiki\Extension\DiscussionTools\CommentFormatter::handleHeading(Wikimedia\Parsoid\DOM\Element, MediaWiki\Parser\ParserOutput, MediaWiki\Extension\DiscussionTools\ThreadItem\ContentHeadingItem, array)
#2/srv/mediawiki/php-1.47.0-wmf.7/extensions/DiscussionTools/includes/CommentFormatter.php(67)MediaWiki\Extension\DiscussionTools\CommentFormatter::addDiscussionToolsInternal(string, MediaWiki\Parser\ParserOutput, MediaWiki\Title\Title)
#3/srv/mediawiki/php-1.47.0-wmf.7/extensions/DiscussionTools/includes/Hooks/ParserHooks.php(72)MediaWiki\Extension\DiscussionTools\CommentFormatter::addDiscussionTools(string, MediaWiki\Parser\ParserOutput, MediaWiki\Title\Title)
#4/srv/mediawiki/php-1.47.0-wmf.7/extensions/DiscussionTools/includes/Hooks/ParserHooks.php(126)MediaWiki\Extension\DiscussionTools\Hooks\ParserHooks->transformHtml(MediaWiki\Parser\ParserOutput, string, MediaWiki\Title\Title, bool)
#5/srv/mediawiki/php-1.47.0-wmf.7/includes/HookContainer/HookContainer.php(127)MediaWiki\Extension\DiscussionTools\Hooks\ParserHooks->onParserOutputPostCacheTransform(MediaWiki\Parser\ParserOutput, string, array)
#6/srv/mediawiki/php-1.47.0-wmf.7/includes/HookContainer/HookRunner.php(3461)MediaWiki\HookContainer\HookContainer->run(string, array, array)
#7/srv/mediawiki/php-1.47.0-wmf.7/includes/OutputTransform/Stages/ExecutePostCacheTransformHooks.php(50)MediaWiki\HookContainer\HookRunner->onParserOutputPostCacheTransform(MediaWiki\Parser\ParserOutput, string, array)
#8/srv/mediawiki/php-1.47.0-wmf.7/includes/OutputTransform/ContentTextTransformStage.php(42)MediaWiki\OutputTransform\Stages\ExecutePostCacheTransformHooks->transformText(string, MediaWiki\Parser\ParserOutput, MediaWiki\Parser\ParserOptions, array)
#9/srv/mediawiki/php-1.47.0-wmf.7/includes/OutputTransform/OutputTransformPipeline.php(79)MediaWiki\OutputTransform\ContentTextTransformStage->transform(MediaWiki\Parser\ParserOutput, MediaWiki\Parser\ParserOptions, array)
#10/srv/mediawiki/php-1.47.0-wmf.7/includes/Page/ParserOutputAccess.php(879)MediaWiki\OutputTransform\OutputTransformPipeline->run(MediaWiki\Parser\ParserOutput, MediaWiki\Parser\ParserOptions, array)
#11/srv/mediawiki/php-1.47.0-wmf.7/includes/Page/ParserOutputAccess.php(830)MediaWiki\Page\ParserOutputAccess::postprocessInPipeline(MediaWiki\OutputTransform\OutputTransformPipeline, MediaWiki\Parser\ParserOutput, MediaWiki\Parser\ParserOptions, MediaWiki\Page\WikiPage, Closure)
#12/srv/mediawiki/php-1.47.0-wmf.7/includes/Page/ParserOutputAccess.php(585)MediaWiki\Page\ParserOutputAccess->postprocess(MediaWiki\Parser\ParserOutput, MediaWiki\Parser\ParserOptions, MediaWiki\Page\WikiPage, MediaWiki\Revision\RevisionStoreCacheRecord)
#13/srv/mediawiki/php-1.47.0-wmf.7/includes/Page/ParserOutputAccess.php(684)MediaWiki\Page\ParserOutputAccess->renderRevision(MediaWiki\Page\WikiPage, MediaWiki\Parser\ParserOptions, MediaWiki\Revision\RevisionStoreCacheRecord, array)
#14/srv/mediawiki/php-1.47.0-wmf.7/includes/PoolCounter/PoolCounterWorkViaCallback.php(68)MediaWiki\Page\ParserOutputAccess->MediaWiki\Page\{closure}()
#15/srv/mediawiki/php-1.47.0-wmf.7/includes/PoolCounter/PoolCounterWork.php(159)MediaWiki\PoolCounter\PoolCounterWorkViaCallback->doWork()
#16/srv/mediawiki/php-1.47.0-wmf.7/includes/Page/ParserOutputAccess.php(498)MediaWiki\PoolCounter\PoolCounterWork->execute()
#17/srv/mediawiki/php-1.47.0-wmf.7/includes/Page/Article.php(886)MediaWiki\Page\ParserOutputAccess->getParserOutput(MediaWiki\Page\WikiPage, MediaWiki\Parser\ParserOptions, MediaWiki\Revision\RevisionStoreCacheRecord, array)
#18/srv/mediawiki/php-1.47.0-wmf.7/includes/Page/Article.php(546)MediaWiki\Page\Article->generateContentOutput(MediaWiki\User\User, MediaWiki\Parser\ParserOptions, int, MediaWiki\Output\OutputPage, array)
#19/srv/mediawiki/php-1.47.0-wmf.7/includes/Actions/ViewAction.php(71)MediaWiki\Page\Article->view()
#20/srv/mediawiki/php-1.47.0-wmf.7/includes/Actions/ActionEntryPoint.php(753)MediaWiki\Actions\ViewAction->show()
#21/srv/mediawiki/php-1.47.0-wmf.7/includes/Actions/ActionEntryPoint.php(511)MediaWiki\Actions\ActionEntryPoint->performAction(MediaWiki\Page\Article, MediaWiki\Title\Title)
#22/srv/mediawiki/php-1.47.0-wmf.7/includes/Actions/ActionEntryPoint.php(145)MediaWiki\Actions\ActionEntryPoint->performRequest()
#23/srv/mediawiki/php-1.47.0-wmf.7/includes/MediaWikiEntryPoint.php(180)MediaWiki\Actions\ActionEntryPoint->execute()
#24/srv/mediawiki/php-1.47.0-wmf.7/index.php(44)MediaWiki\MediaWikiEntryPoint->run()
#25/srv/mediawiki/w/index.php(3)require(string)
#26{main}

Event Timeline

Marking as a train blocker as it appears to cause an logstash error for just loading pages and since wmf.7 got to group1 there have been ~2,500 errors

I noticed this as it was the top error during my deployment

Dreamy_Jazz triaged this task as Unbreak Now! priority.EditedJun 18 2026, 10:28 AM

Marking as UBN as this is marked as a train blocker

Current investigation: this thing SHOULD be an array, and it seems to be in most cases, BUT sometimes an empty stdClass sneaks in there. Looking for "why".

That said, this *probably* means we have "empty stdClass" hidden in ParserCache serializations, and that's not great.

The issue looks like it's around
https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/libs/JsonCodec/+/refs/heads/main/src/JsonCodec.php#376

In short: if a DataParsoid is empty, the check on the previous line returns true on array_is_list (whereas it doesn't when it has non-empty content, since then it's indeed an associative array), it gets converted to stdClass, and that's what we find later everywhere.

I tend to think it's not a great idea to try and force that to [], because it's probably going to break for other serializations; so I suppose this needs to be handled higher in the stack, as in "nope, don't put an empty stdClass in dataParsoid, put a [] instead".

Change #1304053 had a related patch set uploaded (by Isabelle Hurbain-Palatin; author: Isabelle Hurbain-Palatin):

[mediawiki/services/parsoid@master] Fix empty data-parsoid handling in PageBundle

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

Change #1304055 had a related patch set uploaded (by Isabelle Hurbain-Palatin; author: Isabelle Hurbain-Palatin):

[mediawiki/services/parsoid@master] Deserialize empty stdClass as [] in BasePageBundle $parsoid

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

Change #1304061 had a related patch set uploaded (by Isabelle Hurbain-Palatin; author: Isabelle Hurbain-Palatin):

[mediawiki/extensions/DiscussionTools@master] Check that data-parsoid is an array before accessing it as such

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

Change #1304061 merged by jenkins-bot:

[mediawiki/extensions/DiscussionTools@master] Check that data-parsoid is an array before accessing it as such

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

https://gerrit.wikimedia.org/r/c/mediawiki/extensions/DiscussionTools/+/1304061 should unblock the train. (ignore the other patches - they're at best WIP attempts to fix the actual issue, but the DT patch fixes the symptoms at least)

Change #1304082 had a related patch set uploaded (by Isabelle Hurbain-Palatin; author: Isabelle Hurbain-Palatin):

[mediawiki/extensions/DiscussionTools@wmf/1.47.0-wmf.7] Check that data-parsoid is an array before accessing it as such

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

Change #1304082 merged by jenkins-bot:

[mediawiki/extensions/DiscussionTools@wmf/1.47.0-wmf.7] Check that data-parsoid is an array before accessing it as such

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

Mentioned in SAL (#wikimedia-operations) [2026-06-18T14:53:32Z] <cscott@deploy1003> Started scap sync-world: Backport for [[gerrit:1304082|Check that data-parsoid is an array before accessing it as such (T429582)]]

Mentioned in SAL (#wikimedia-operations) [2026-06-18T14:55:32Z] <cscott@deploy1003> ihurbain, cscott: Backport for [[gerrit:1304082|Check that data-parsoid is an array before accessing it as such (T429582)]] synced to the testservers (see https://wikitech.wikimedia.org/wiki/Mwdebug). Changes can now be verified there.

Mentioned in SAL (#wikimedia-operations) [2026-06-18T15:04:50Z] <cscott@deploy1003> Finished scap sync-world: Backport for [[gerrit:1304082|Check that data-parsoid is an array before accessing it as such (T429582)]] (duration: 11m 17s)

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

[mediawiki/extensions/DiscussionTools@master] CommentFormatter: Allow data-parsoid to be an object as well as an array

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

Change #1304638 merged by jenkins-bot:

[mediawiki/extensions/DiscussionTools@master] CommentFormatter: Allow data-parsoid to be an object as well as an array

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

matmarex changed the task status from Open to Stalled.Jun 22 2026, 4:44 PM
matmarex lowered the priority of this task from Unbreak Now! to Needs Triage.
matmarex subscribed.

Not an unbreak-now any more, but I'm not sure what work is remaining here.