Page MenuHomePhabricator

Language::listToText() assumes the indexs in a list start at 0 and are consecutive.
Closed, ResolvedPublic

Description

Language::listToText() uses for(;;) which assumes the index in a list starts at 0 and following keys are consecutive integers.

This assumption fails (and results in warnings with E_STRICT) when SpecialListGroupRights::formatPermissions() uses the key-preserving array_intersect() to create a subset of $allGroups.

Solutions include using array_values() (again) in SpecialListGroupRights::formatPermissions() or to change Language::listToText() so that it uses array_values() or foreach()

(I prefer the latter.)

Details

Related Gerrit Patches:

Related Objects

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJul 13 2018, 6:01 PM
MarkAHershberger updated the task description. (Show Details)

Change 445653 had a related patch set uploaded (by MarkAHershberger; owner: MarkAHershberger):
[mediawiki/core@master] Fix some warnings

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

Change 445653 merged by jenkins-bot:
[mediawiki/core@master] Language::listToText: Avoid PHP warnings from E_STRICT

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

Jdforrester-WMF closed this task as Resolved.Jul 20 2018, 5:57 AM
Jdforrester-WMF assigned this task to MarkAHershberger.
Jdforrester-WMF removed a project: Patch-For-Review.