Page MenuHomePhabricator

TypeError: Argument 1 passed to MediaWiki\Revision\RevisionStore::newRevisionFromRowAndSlots() must be an instance of stdClass
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error
normalized_message
[{reqId}] {exception_url}   TypeError: Argument 1 passed to MediaWiki\Revision\RevisionStore::newRevisionFromRowAndSlots() must be an instance of stdClass, instance of Flow\Formatter\ContributionsRow given, called in /srv/mediawiki/php-1.37.0-wmf.18/inclu
exception.trace
from /srv/mediawiki/php-1.37.0-wmf.18/includes/Revision/RevisionStore.php(1653)
#0 /srv/mediawiki/php-1.37.0-wmf.18/includes/Revision/RevisionStore.php(1556): MediaWiki\Revision\RevisionStore->newRevisionFromRowAndSlots(Flow\Formatter\ContributionsRow, NULL, integer, NULL, boolean)
#1 /srv/mediawiki/php-1.37.0-wmf.18/includes/specials/pagers/ContribsPager.php(601): MediaWiki\Revision\RevisionStore->newRevisionFromRow(Flow\Formatter\ContributionsRow, integer, NULL)
#2 /srv/mediawiki/php-1.37.0-wmf.18/includes/specials/pagers/ContribsPager.php(635): ContribsPager->tryCreatingRevisionRecord(Flow\Formatter\ContributionsRow, NULL)
#3 /srv/mediawiki/php-1.37.0-wmf.18/includes/pager/IndexPager.php(611): ContribsPager->formatRow(Flow\Formatter\ContributionsRow)
#4 /srv/mediawiki/php-1.37.0-wmf.18/includes/specials/SpecialContributions.php(318): IndexPager->getBody()
#5 /srv/mediawiki/php-1.37.0-wmf.18/includes/poolcounter/PoolCounterWorkViaCallback.php(74): SpecialContributions->{closure}()
#6 /srv/mediawiki/php-1.37.0-wmf.18/includes/poolcounter/PoolCounterWork.php(162): PoolCounterWorkViaCallback->doWork()
#7 /srv/mediawiki/php-1.37.0-wmf.18/includes/specials/SpecialContributions.php(333): PoolCounterWork->execute()
#8 /srv/mediawiki/php-1.37.0-wmf.18/includes/specialpage/SpecialPage.php(646): SpecialContributions->execute(string)
#9 /srv/mediawiki/php-1.37.0-wmf.18/includes/specialpage/SpecialPageFactory.php(1365): SpecialPage->run(string)
#10 /srv/mediawiki/php-1.37.0-wmf.18/includes/MediaWiki.php(314): MediaWiki\SpecialPage\SpecialPageFactory->executePath(string, RequestContext)
#11 /srv/mediawiki/php-1.37.0-wmf.18/includes/MediaWiki.php(925): MediaWiki->performRequest()
#12 /srv/mediawiki/php-1.37.0-wmf.18/includes/MediaWiki.php(559): MediaWiki->main()
#13 /srv/mediawiki/php-1.37.0-wmf.18/index.php(53): MediaWiki->run()
#14 /srv/mediawiki/php-1.37.0-wmf.18/index.php(46): wfIndexMain()
#15 /srv/mediawiki/w/index.php(3): require(string)
#16 {main}
Impact

10 erros in the last 30 min on group0

Notes

Event Timeline

On testwiki wmf.18 - Special:Contirbutions will produce the error.
mediwiki wmg.18 Special:Contiributions will display [648913f3-a1fd-4b14-bb87-78807ced0197] 2021-08-10 19:43:46: Fatal exception of type "TypeError".

Other Special pages seem to be fine.

Zabe triaged this task as Unbreak Now! priority.Aug 10 2021, 8:19 PM

FYI this breaks special:Contributions (in certain cases), which means patrollers cannot really do their jobs with this bug in place. I'd appreciate a rollback.

The trivial fix is to drop the stdClass typehint from the first parameter of RevisionStore::newRevisionFromRowAndSlots(). Seems like Flow is doing something quite messy here, though - the object comes from a DB query result in IndexPager::getBody() so no idea how it ends up with the type Flow\Formatter\ContributionsRow.

Also the class had a Assert::parameterType( \stdClass::class, $row, '$row' ); check previously, so how is that different from a type hint?

Change 711204 had a related patch set uploaded (by TChin; author: TChin):

[mediawiki/core@master] Fix TypeError in Special:Contirbutions

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

TIL that exceptions and throwables are different things in PHP. ContribsPager.php just needs to catch a Throwable now instead of Exception.

Throwable is relatively recent (PHP 7). Any code trying to catch Exception has probably been written before that and should be fixed. Filed as T288582: Most try-catch clauses in MediaWiki should use Throwable instead of Exception.

Change 711204 abandoned by TChin:

[mediawiki/core@master] Fix TypeError in Special:Contirbutions

Reason:

Taking a different approach to the issue -- patch will be submitted by someone else

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

Change 711219 had a related patch set uploaded (by Tim Starling; author: Tim Starling):

[mediawiki/core@master] ContribsPager row filtering with RevisionStore::isRevisionRow

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

Test wiki created on Patch Demo by PPchelko (WMF) using patch(es) linked to this task:

https://patchdemo.wmflabs.org/wikis/451fed4188/w/

Change 711219 merged by jenkins-bot:

[mediawiki/core@master] ContribsPager row filtering with RevisionStore::isRevisionRow

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

Change 710722 had a related patch set uploaded (by Jforrester; author: Tim Starling):

[mediawiki/core@wmf/1.37.0-wmf.18] ContribsPager row filtering with RevisionStore::isRevisionRow

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

Change 710722 merged by jenkins-bot:

[mediawiki/core@wmf/1.37.0-wmf.18] ContribsPager row filtering with RevisionStore::isRevisionRow

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

Mentioned in SAL (#wikimedia-operations) [2021-08-11T17:32:31Z] <jforrester@deploy1002> Synchronized php-1.37.0-wmf.18/includes/Revision/RevisionStore.php: T288563 Don't explode Special:Contributions on extension-formatted rows (1/3) (duration: 01m 09s)

Mentioned in SAL (#wikimedia-operations) [2021-08-11T17:34:01Z] <jforrester@deploy1002> Synchronized php-1.37.0-wmf.18/includes/Revision/RevisionFactory.php: T288563 Don't explode Special:Contributions on extension-formatted rows (2/3) (duration: 01m 08s)

Mentioned in SAL (#wikimedia-operations) [2021-08-11T17:35:42Z] <jforrester@deploy1002> Synchronized php-1.37.0-wmf.18/includes/specials/pagers/ContribsPager.php: T288563 Don't explode Special:Contributions on extension-formatted rows (3/3) (duration: 01m 06s)

It looks like DeletedContribsPager.php also needs a fix. I get a TypeError when I go to https://www.mediawiki.org/wiki/Special:DeletedContributions/Matin235.

It looks like DeletedContribsPager.php also needs a fix. I get a TypeError when I go to https://www.mediawiki.org/wiki/Special:DeletedContributions/Matin235.

Confirmed:

[60cec1f4-8b88-49e1-a0eb-b68b84121cd5] /wiki/Special:DeletedContributions/Matin235   TypeError: Argument 1 passed to MediaWiki\Revision\RevisionStore::newRevisionFromArchiveRowAndSlots() must be an instance of stdClass, instance of Flow\Formatter\DeletedContributionsRow given, called in /srv/mediawiki/php-1.37.0-wmf.18/includes/Revision/RevisionStore.php on line 1535
from /srv/mediawiki/php-1.37.0-wmf.18/includes/Revision/RevisionStore.php(1578)
#0 /srv/mediawiki/php-1.37.0-wmf.18/includes/Revision/RevisionStore.php(1535): MediaWiki\Revision\RevisionStore->newRevisionFromArchiveRowAndSlots(Flow\Formatter\DeletedContributionsRow, NULL, integer, NULL, array)
#1 /srv/mediawiki/php-1.37.0-wmf.18/includes/specials/pagers/DeletedContribsPager.php(267): MediaWiki\Revision\RevisionStore->newRevisionFromArchiveRow(Flow\Formatter\DeletedContributionsRow)
#2 /srv/mediawiki/php-1.37.0-wmf.18/includes/pager/IndexPager.php(611): DeletedContribsPager->formatRow(Flow\Formatter\DeletedContributionsRow)
#3 /srv/mediawiki/php-1.37.0-wmf.18/includes/specials/SpecialDeletedContributions.php(170): IndexPager->getBody()
#4 /srv/mediawiki/php-1.37.0-wmf.18/includes/specialpage/SpecialPage.php(646): SpecialDeletedContributions->execute(string)
#5 /srv/mediawiki/php-1.37.0-wmf.18/includes/specialpage/SpecialPageFactory.php(1365): SpecialPage->run(string)
#6 /srv/mediawiki/php-1.37.0-wmf.18/includes/MediaWiki.php(314): MediaWiki\SpecialPage\SpecialPageFactory->executePath(string, RequestContext)
#7 /srv/mediawiki/php-1.37.0-wmf.18/includes/MediaWiki.php(925): MediaWiki->performRequest()
#8 /srv/mediawiki/php-1.37.0-wmf.18/includes/MediaWiki.php(559): MediaWiki->main()
#9 /srv/mediawiki/php-1.37.0-wmf.18/index.php(53): MediaWiki->run()
#10 /srv/mediawiki/php-1.37.0-wmf.18/index.php(46): wfIndexMain()
#11 /srv/mediawiki/w/index.php(3): require(string)
#12 {main}

I'm going to close this task again, and reopen @mewoph's one, as this is currently flagged as a past train blocker (and an UBN), and I don't think neither of those flags should apply for the new bug (and I don't want to simply declassify this as a train blocker).

Test wiki on Patch demo by PPchelko (WMF) using patch(es) linked to this task was deleted:

https://patchdemo.wmflabs.org/wikis/451fed4188/w/