Page MenuHomePhabricator

MobileViewAPI throws undefined index notice and other warnings
Closed, ResolvedPublic1 Estimate Story Points

Description

Am seeing the following issue in logstash.

Notice: Undefined index: pageprops in /srv/mediawiki/php-1.32.0-wmf.4/extensions/MobileFrontend/includes/api/ApiMobileView.php on line 149

Also seeing:
Warning: Invalid operand type was used: array_key_exists expects an array or an object; false returned. in /srv/mediawiki/php-1.32.0-wmf.4/extensions/MobileFrontend/includes/api/ApiMobileView.php on line 269
Warning: Invalid operand type was used: array_key_exists expects an array or an object; false returned. in /srv/mediawiki/php-1.32.0-wmf.4/extensions/MobileFrontend/includes/api/ApiMobileView.php on line 275
[{exception_id}] {exception_url} ErrorException from line 269 of /srv/mediawiki/php-1.32.0-wmf.4/extensions/MobileFrontend/includes/api/ApiMobileView.php: PHP Warning: Invalid operand type was used: array_key_exists expects an array or an object; false 7
[{exception_id}] {exception_url} ErrorException from line 275 of /srv/mediawiki/php-1.32.0-wmf.4/extensions/MobileFrontend/includes/api/ApiMobileView.php: PHP Warning: Invalid operand type was used: array_key_exists expects an array or an object; false

Possibly related to T192837 given the timing.

Details

Related Gerrit Patches:
mediawiki/extensions/MobileFrontend : masterVerify that data['pageprops'] exists before using it
mediawiki/extensions/MobileFrontend : masterEnsure pageprops are available before use

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMay 29 2018, 3:39 PM
Jdlrobson set the point value for this task to 1.May 29 2018, 4:33 PM
bearND added a subscriber: bearND.May 29 2018, 5:35 PM

Could you list some examples of pages that cause this or a link to the logstash query?

Change 436077 had a related patch set uploaded (by BearND; owner: BearND):
[mediawiki/extensions/MobileFrontend@master] Ensure pageprops are available before use

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

Change 436094 had a related patch set uploaded (by Pmiazga; owner: Pmiazga):
[mediawiki/extensions/MobileFrontend@master] Verify that data['pageprops'] exists before using it

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

pmiazga added a subscriber: pmiazga.EditedMay 29 2018, 7:44 PM

Bringing to sprint as it's polluting our logs. Another example of just do it task. Oh, now I see that @bearND also made a patch.

@bearND could you check my patch: https://gerrit.wikimedia.org/r/436094 -> it verifies that key exists and also verifies that this is an array. I'm sorry, I didn't notice you also fixed it.
The patch submitted by you solves Notice: Undefined index: pageprops error, but

Warning: Invalid operand type was used: array_key_exists expects an array or an object; false returned

can still occur when $data['pageprops'] is something other than array (false for example).

Change 436077 abandoned by BearND:
Ensure pageprops are available before use

Reason:
in favor of I4ece5a01425

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

@pmiazga Your patch looks better to me. Thanks!

Change 436094 merged by jenkins-bot:
[mediawiki/extensions/MobileFrontend@master] Verify that data['pageprops'] exists before using it

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

ovasileva triaged this task as Medium priority.May 30 2018, 12:57 PM

This can skip QA. It will be live next week. We'll want to check that logstash is clean again. Alternatively we can resolve this now and lean on chores to bubble this up if it's a problem!

Jdlrobson closed this task as Resolved.Jun 4 2018, 5:08 PM
Jdlrobson claimed this task.
Vvjjkkii renamed this task from MobileViewAPI throws undefined index notice and other warnings to f2baaaaaaa.Jul 1 2018, 1:09 AM
Vvjjkkii reopened this task as Open.
Vvjjkkii removed Jdlrobson as the assignee of this task.
Vvjjkkii raised the priority of this task from Medium to High.
Vvjjkkii updated the task description. (Show Details)
Vvjjkkii removed the point value for this task.
Vvjjkkii removed subscribers: gerritbot, Aklapper.
CommunityTechBot renamed this task from f2baaaaaaa to MobileViewAPI throws undefined index notice and other warnings.Jul 2 2018, 2:56 AM
CommunityTechBot closed this task as Resolved.
CommunityTechBot assigned this task to Jdlrobson.
CommunityTechBot lowered the priority of this task from High to Medium.
CommunityTechBot set the point value for this task to 1.
CommunityTechBot updated the task description. (Show Details)
CommunityTechBot added subscribers: gerritbot, Aklapper.