Page MenuHomePhabricator

ActorMigration.php: PHP Warning: Invalid argument supplied for foreach (via RevisionStore::getRecentChange)
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error

MediaWiki version: 1.35.0-wmf.5

message
PHP Warning: Invalid argument supplied for foreach()
exception.trace
#0 /srv/mediawiki/php-1.35.0-wmf.5/includes/ActorMigration.php(382): MWExceptionHandler::handleError(integer, string, string, integer, array)
#1 /srv/mediawiki/php-1.35.0-wmf.5/includes/Revision/RevisionStore.php(1147): ActorMigration->getWhere(Wikimedia\Rdbms\DBConnRef, string, NULL, boolean)
#2 /srv/mediawiki/php-1.35.0-wmf.5/includes/api/ApiPatrol.php(51): MediaWiki\Revision\RevisionStore->getRecentChange(MediaWiki\Revision\RevisionStoreRecord)
#3 /srv/mediawiki/php-1.35.0-wmf.5/includes/api/ApiMain.php(1603): ApiPatrol->execute()
#4 /srv/mediawiki/php-1.35.0-wmf.5/includes/api/ApiMain.php(539): ApiMain->executeAction()
#5 /srv/mediawiki/php-1.35.0-wmf.5/includes/api/ApiMain.php(510): ApiMain->executeActionWithErrorHandling()
#6 /srv/mediawiki/php-1.35.0-wmf.5/api.php(83): ApiMain->execute()
#7 /srv/mediawiki/w/api.php(3): require(string)
#8 {main}

Impact

Unsure. To be determined. Due to it being silent error, it is possible that things work fine, or it might be corrupting after this part in the code in a way that makes the API(s) question behave incorrectly.

Notes

Details

Request ID
XeCXTgpAIDYAAFvfkq4AAAAL
Request URL
https://commons.wikimedia.org/w/api.php

Event Timeline

See also T207217 which triggers the same bug in ActorMigration.php from SpecialNewFiles.

If we uphold that this is the callers responsibility, then, after these two issues are fixed, this might be a good place to adopt a type hint so as to make these fail hard instead of allowing execution to silently continue. Or, if silent continuation happens to result in the correct behaviour, then for the code to skip the loop explicitly.

Anomie subscribed.

If we uphold that this is the callers responsibility, then, after these two issues are fixed, this might be a good place to adopt a type hint so as to make these fail hard instead of allowing execution to silently continue.

The parameter is documented as "UserIdentity|UserIdentity[]". Passing something else shouldn't be allowed. But currently PHP doesn't support a type hint that would match that.

Change 554521 had a related patch set uploaded (by Anomie; owner: Anomie):
[mediawiki/core@master] Remove hacks for lack of index on rc_this_oldid

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

Change 554522 had a related patch set uploaded (by Anomie; owner: Anomie):
[mediawiki/core@master] ActorMigration: Improve getWhere() handling of $users

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

Change 554521 merged by jenkins-bot:
[mediawiki/core@master] Remove hacks for lack of index on rc_this_oldid

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

Change 554522 merged by jenkins-bot:
[mediawiki/core@master] ActorMigration: Improve getWhere() handling of $users

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