Page MenuHomePhabricator

Unexpected type issue in an EchoEventPresentationModel::jsonSerialize
Closed, ResolvedPublic

Description

Spotted in Wikimedia error log:

Warning: array_values() expects parameter 1 to be an array or collection
in /srv/mediawiki/php-1.28.0-wmf.18/extensions/Echo/includes/formatters/Event
PresentationModel.php on line 494

Warning: array_filter() expects parameter 1 to be an array or collection
in /srv/mediawiki/php-1.28.0-wmf.18/extensions/Echo/includes/formatters/Event
PresentationModel.php on line 494

https://github.com/wikimedia/mediawiki-extensions-Echo/blob/wmf/1.28.0-wmf.18/includes/formatters/EventPresentationModel.php#L494

getSecondaryLinks() is intended to return an array but a non identified class implementing it returns a non array value instead.

Event Timeline

Dereckson created this task.Sep 9 2016, 7:31 PM
Restricted Application added a project: Collaboration-Team-Triage. · View Herald TranscriptSep 9 2016, 7:31 PM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Dereckson claimed this task.Sep 9 2016, 7:39 PM

MentionStatusPresentationModel::getSecondaryLinks() could return false. Fixing that.

Furthermore, I've checked Thanks and Flow (thanks Moriel), then other extensions (thanks Roan for this search URL), all are well returning an array.

Change 309630 had a related patch set uploaded (by Dereckson):
Fix MentionStatusPresentationModel::getSecondaryLinks return value

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

Change 309630 merged by jenkins-bot:
Fix MentionStatusPresentationModel::getSecondaryLinks return value

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

Catrope closed this task as Resolved.Sep 12 2016, 9:23 PM

As it appeared a few times in production error log, shouldn't we backport it?