Page MenuHomePhabricator

count(): Parameter must be an array or an object that implements Countable
Closed, ResolvedPublic

Description

Hi, im seeing:

PHP Warning:  count(): Parameter must be an array or an object that implements Countable in /srv/mediawiki/w/extensions/CentralAuth/includes/CentralAuthUser.php on line 1683

I guess because https://github.com/wikimedia/mediawiki-extensions-CentralAuth/blob/REL1_31/includes/CentralAuthUser.php#L1676 changes the value from a array to something else?

Event Timeline

Reedy renamed this task from count(): Parameter must be an array or an object that implements Countabl to count(): Parameter must be an array or an object that implements Countable.Jan 5 2019, 4:48 PM

How can count() apparently work fine on the line before in the If?

The second if is before it’s turned into a string

Because it's changing the value?

The count is run before the value is changed...

Sorry, it’s hard to read with no line numbers on mobile, especially when the lines you link call the same problematic functions

Move that line before the two lines that change them to strings, or use temp variables for the strings and update the usages

Change 482416 had a related patch set uploaded (by Paladox; owner: Paladox):
[mediawiki/extensions/CentralAuth@master] Fix "count(): Parameter must be an array or an object that implements Countable"

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

Change 482416 merged by jenkins-bot:
[mediawiki/extensions/CentralAuth@master] Fix "count(): Parameter must be an array or an object that implements Countable"

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

Change 482484 had a related patch set uploaded (by Paladox; owner: Paladox):
[mediawiki/extensions/CentralAuth@REL1_32] Fix "count(): Parameter must be an array or an object that implements Countable"

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

Change 482485 had a related patch set uploaded (by Paladox; owner: Paladox):
[mediawiki/extensions/CentralAuth@REL1_31] Fix "count(): Parameter must be an array or an object that implements Countable"

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

Change 482486 had a related patch set uploaded (by Paladox; owner: Paladox):
[mediawiki/extensions/CentralAuth@REL1_30] Fix "count(): Parameter must be an array or an object that implements Countable"

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

Change 482486 merged by jenkins-bot:
[mediawiki/extensions/CentralAuth@REL1_30] Fix "count(): Parameter must be an array or an object that implements Countable"

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

Change 482485 merged by jenkins-bot:
[mediawiki/extensions/CentralAuth@REL1_31] Fix "count(): Parameter must be an array or an object that implements Countable"

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

Change 482484 merged by jenkins-bot:
[mediawiki/extensions/CentralAuth@REL1_32] Fix "count(): Parameter must be an array or an object that implements Countable"

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

Paladox claimed this task.
Paladox removed Paladox as the assignee of this task.