Page MenuHomePhabricator

TypeError: Argument 6 passed to ContentTranslation\Entity\RecentSignificantEdit::__construct() must be of the type array, object given
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error
normalized_message
[{reqId}] {exception_url}   TypeError: Argument 6 passed to ContentTranslation\Entity\RecentSignificantEdit::__construct() must be of the type array, object given, called in /srv/mediawiki/php-1.40.0-wmf.4/extensions/ContentTranslation/includes/Store/Rece
exception.trace
from /srv/mediawiki/php-1.40.0-wmf.4/extensions/ContentTranslation/includes/Entity/RecentSignificantEdit.php(31)
#0 /srv/mediawiki/php-1.40.0-wmf.4/extensions/ContentTranslation/includes/Store/RecentSignificantEditStore.php(231): ContentTranslation\Entity\RecentSignificantEdit->__construct(integer, integer, integer, string, string, stdClass, string)
#1 /srv/mediawiki/php-1.40.0-wmf.4/extensions/ContentTranslation/includes/Store/RecentSignificantEditStore.php(163): ContentTranslation\Store\RecentSignificantEditStore->createEditFromRow(stdClass)
#2 /srv/mediawiki/php-1.40.0-wmf.4/extensions/ContentTranslation/includes/HookHandler/SignificantEditCreationHandler.php(104): ContentTranslation\Store\RecentSignificantEditStore->findExistingEdit(integer, integer, string)
#3 /srv/mediawiki/php-1.40.0-wmf.4/includes/deferred/MWCallableUpdate.php(38): ContentTranslation\HookHandler\SignificantEditCreationHandler::ContentTranslation\HookHandler\{closure}()
#4 /srv/mediawiki/php-1.40.0-wmf.4/includes/deferred/DeferredUpdates.php(474): MWCallableUpdate->doUpdate()
#5 /srv/mediawiki/php-1.40.0-wmf.4/includes/deferred/DeferredUpdates.php(399): DeferredUpdates::attemptUpdate(MWCallableUpdate, Wikimedia\Rdbms\LBFactoryMulti)
#6 /srv/mediawiki/php-1.40.0-wmf.4/includes/deferred/DeferredUpdates.php(214): DeferredUpdates::run(MWCallableUpdate, Wikimedia\Rdbms\LBFactoryMulti, Monolog\Logger, BufferingStatsdDataFactory, MediaWiki\JobQueue\JobQueueGroupFactory, string)
#7 /srv/mediawiki/php-1.40.0-wmf.4/includes/deferred/DeferredUpdatesScope.php(267): DeferredUpdates::{closure}(MWCallableUpdate, integer)
#8 /srv/mediawiki/php-1.40.0-wmf.4/includes/deferred/DeferredUpdatesScope.php(196): DeferredUpdatesScope->processStageQueue(integer, integer, Closure)
#9 /srv/mediawiki/php-1.40.0-wmf.4/includes/deferred/DeferredUpdates.php(235): DeferredUpdatesScope->processUpdates(integer, Closure)
#10 /srv/mediawiki/php-1.40.0-wmf.4/includes/MediaWiki.php(1104): DeferredUpdates::doUpdates()
#11 /srv/mediawiki/php-1.40.0-wmf.4/includes/MediaWiki.php(838): MediaWiki->restInPeace()
#12 /srv/mediawiki/php-1.40.0-wmf.4/api.php(125): MediaWiki->doPostOutputShutdown()
#13 /srv/mediawiki/php-1.40.0-wmf.4/api.php(45): wfApiMain()
#14 /srv/mediawiki/w/api.php(3): require(string)
#15 {main}
Impact
Notes

Seems new in 1.40.0-wmf.4 (T314193). Making a blocker for the moment.

Event Timeline

brennen triaged this task as Unbreak Now! priority.Oct 6 2022, 7:32 PM
brennen created this task.

The result of json_decode from $row->cxse_section_titles is given to an array type hinted constructor. Only a value from json_encode is written into the cxse_section_titles column.

The value is json encoding the result of RecentSignificantEdit::getSectionTitles itself type hinted as array.

Sounds good and nothing of that code changed.

But empty array's are often encoded as {}, not []. When there are changed from json to php it can result in an (empty) stdClass object.

It is wrong that the section link is empty or is that okay? Maybe that is the regression, why this was not happen before.
Not sure if the json representation changed between php versions (now using 7.4)
Adding a (array) cast after json encode could help

Change 840068 had a related patch set uploaded (by Nik Gkountas; author: Nik Gkountas):

[mediawiki/extensions/ContentTranslation@master] RecentSignificantEditStore: Force section titles to be an index array

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

Change 840041 had a related patch set uploaded (by KartikMistry; author: Nik Gkountas):

[mediawiki/extensions/ContentTranslation@wmf/1.40.0-wmf.4] RecentSignificantEditStore: Force section titles to be an index array

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

Change 840068 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] RecentSignificantEditStore: Force section titles to be an index array

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

Change 840041 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@wmf/1.40.0-wmf.4] RecentSignificantEditStore: Force section titles to be an index array

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

Mentioned in SAL (#wikimedia-operations) [2022-10-07T16:43:37Z] <brennen@deploy1002> Started scap: Backport for [[gerrit:840041|RecentSignificantEditStore: Force section titles to be an index array (T319799)]]

Mentioned in SAL (#wikimedia-operations) [2022-10-07T16:44:00Z] <brennen@deploy1002> brennen and kartik: Backport for [[gerrit:840041|RecentSignificantEditStore: Force section titles to be an index array (T319799)]] synced to the testservers: mwdebug1001.eqiad.wmnet, mwdebug2001.codfw.wmnet, mwdebug2002.codfw.wmnet, mwdebug1002.eqiad.wmnet

Mentioned in SAL (#wikimedia-operations) [2022-10-07T16:50:19Z] <brennen@deploy1002> Finished scap: Backport for [[gerrit:840041|RecentSignificantEditStore: Force section titles to be an index array (T319799)]] (duration: 06m 41s)