Page MenuHomePhabricator

PHP Notice: Undefined offset: 0
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error

MediaWiki version: 1.36.0-wmf.26

message
PHP Notice: Undefined offset: 0

Impact

A few of this just happened, on testwiki. From sandbox. I assume this is ultimately caused by client error, but the server code should handle those without causing errors or log messages, I think.

I don't know if this is related to T271804: PHP Notice: Undefined index: Alsjdakjsdh but I would assume not, due to the different error message.

Notes

URL: /w/api.php (POST, so nor URL parameters)
Referrer: https://test.wikipedia.org/wiki/Special:ApiSandbox

Details

Request ID
X-2lUApAMMwAA2jZytgAAAEP
Request URL
https://test.wikipedia.org/w/api.php
Stack Trace
exception.trace
#0 /srv/mediawiki/php-1.36.0-wmf.26/includes/api/ApiQueryInfo.php(530): MWExceptionHandler::handleError(integer, string, string, integer, array)
#1 /srv/mediawiki/php-1.36.0-wmf.26/includes/api/ApiQueryInfo.php(426): ApiQueryInfo->extractPageInfo(integer, Title)
#2 /srv/mediawiki/php-1.36.0-wmf.26/includes/api/ApiQuery.php(269): ApiQueryInfo->execute()
#3 /srv/mediawiki/php-1.36.0-wmf.26/includes/api/ApiMain.php(1612): ApiQuery->execute()
#4 /srv/mediawiki/php-1.36.0-wmf.26/includes/api/ApiMain.php(592): ApiMain->executeAction()
#5 /srv/mediawiki/php-1.36.0-wmf.26/includes/api/ApiMain.php(563): ApiMain->executeActionWithErrorHandling()
#6 /srv/mediawiki/php-1.36.0-wmf.26/api.php(90): ApiMain->execute()
#7 /srv/mediawiki/php-1.36.0-wmf.26/api.php(45): wfApiMain()
#8 /srv/mediawiki/w/api.php(3): require(string)
#9 {main}

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptTue, Jan 12, 1:44 PM
LarsWirzenius triaged this task as Unbreak Now! priority.Tue, Jan 12, 1:52 PM

Now a total of 8 of these. On testwiki, which is a worrying sign, even if root cause is badly behaving client. Making a train blocker, as a large number of log messages is a problem in and of itself.

I can reproduce this on my local wiki, but not on testwiki (I don't know why).

I reproduce by submitting Special:ApiSandbox#action=query&format=json&prop=info&titles=<page>&inprop=notificationtimestamp. For a <page> which you are not currently watching.

I am flagging @MusikAnimal for this and for T271804.

Restricted Application added a project: Growth-Team. · View Herald TranscriptTue, Jan 12, 2:06 PM

This seems like a simply error to fix. $this->notificationtimestamps should only contain timestamps for a given set of pages, so not something that you'd check with an implicit bool casts. Line 530 should use isset, as that seems to be the original intention.

Change 655665 had a related patch set uploaded (by Daniel Kinzler; owner: Daniel Kinzler):
[mediawiki/core@master] Fix undefined index error in ApiQueryInfo

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

daniel added a subscriber: daniel.Tue, Jan 12, 2:20 PM

Triggered by requesting page info of non-existing pages. Should be fixed by the patch I just uploaded.

Change 655665 merged by jenkins-bot:
[mediawiki/core@master] Fix undefined index error in ApiQueryInfo

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

Change 655671 had a related patch set uploaded (by ArielGlenn; owner: Daniel Kinzler):
[mediawiki/core@wmf/1.36.0-wmf.26] Fix undefined index error in ApiQueryInfo

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

Change 655671 merged by jenkins-bot:
[mediawiki/core@wmf/1.36.0-wmf.26] Fix undefined index error in ApiQueryInfo

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

Mentioned in SAL (#wikimedia-operations) [2021-01-12T19:01:35Z] <ariel@deploy1001> Synchronized php-1.36.0-wmf.26/includes/api/ApiQueryInfo.php: Backport: (gerrit 655671) Fix undefined index error in ApiQueryInfo (T271815) (duration: 01m 06s)

Seems like it works to me. Would the reporter like to verify?

ArielGlenn closed this task as Resolved.Wed, Jan 13, 1:12 PM
ArielGlenn claimed this task.

Being bold and closing.