Page MenuHomePhabricator

PHP Warning: Invalid argument supplied for foreach()
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error

MediaWiki version: 1.35.0-wmf.15

message
PHP Warning: Invalid argument supplied for foreach()

Impact

Happened during this week's train. Not a lot of times. Doesn't seem urgent, but reporting anyway so it's not forgotten, as it seems like a clear programming error.

Notes

Details

Request ID
Xh8eTApAEMMAAAjli0EAAABL
Request URL
https://ca.wikipedia.org/w/api.php
Stack Trace
exception.trace
#0 /srv/mediawiki/php-1.35.0-wmf.15/extensions/Wikibase/client/includes/Api/PageTerms.php(108): MWExceptionHandler::handleError(integer, string, string, integer, array)
#1 /srv/mediawiki/php-1.35.0-wmf.15/extensions/Wikibase/client/includes/Api/PageTerms.php(76): Wikibase\Client\Api\PageTerms->getTermsOfEntities(array, array, string)
#2 /srv/mediawiki/php-1.35.0-wmf.15/includes/api/ApiQuery.php(255): Wikibase\Client\Api\PageTerms->execute()
#3 /srv/mediawiki/php-1.35.0-wmf.15/includes/api/ApiMain.php(1603): ApiQuery->execute()
#4 /srv/mediawiki/php-1.35.0-wmf.15/includes/api/ApiMain.php(539): ApiMain->executeAction()
#5 /srv/mediawiki/php-1.35.0-wmf.15/includes/api/ApiMain.php(510): ApiMain->executeActionWithErrorHandling()
#6 /srv/mediawiki/php-1.35.0-wmf.15/api.php(78): ApiMain->execute()
#7 /srv/mediawiki/w/api.php(3): require(string)
#8 {main}

Event Timeline

I think this affects any page whose connected item has no aliases; I wrote a query for those, and after opening some of the resulting API URLs, I could see the corresponding warnings with the same URLs in logstash. (That query link searches cawiki, but I also tested it against hewiki, in case the slightly larger error volume on that wikis is also noticeable.)

There's about 120 of these now, and the count is going up. I'm not quite worried enough to make it a train blocker, yet, but it'd be nice to have this looked at anyway.

Change 565031 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[mediawiki/extensions/Wikibase@master] Fix invalid iteration over false in PageTerms

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

Some of the count going up was probably my fault, sorry (it took me a while to realize that this is a PHP warning, so I wouldn’t see it in the API output – so I kept making API requests that triggered this for a while ^^)

Change 565034 had a related patch set uploaded (by Addshore; owner: Lucas Werkmeister (WMDE)):
[mediawiki/extensions/Wikibase@wmf/1.35.0-wmf.15] Fix invalid iteration over false in PageTerms

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

Moving to our verification column.
The patch is good to be backported to fix the issue for the train.
https://gerrit.wikimedia.org/r/565034

Change 565031 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Fix invalid iteration over false in PageTerms

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

Change 565034 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@wmf/1.35.0-wmf.15] Fix invalid iteration over false in PageTerms

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

Mentioned in SAL (#wikimedia-operations) [2020-01-15T15:40:47Z] <ladsgroup@deploy1001> Synchronized php-1.35.0-wmf.15/extensions/Wikibase/client/includes/Api/PageTerms.php: [[gerrit:565034|Fix invalid iteration over false in PageTerms (T242856)]] (duration: 01m 06s)