Parameter must be an array or an object that implements Countable
Open, Needs TriagePublic

Description

Seen on travis on PHP 7.2 https://travis-ci.org/wikimedia/mediawiki/jobs/368430010

  • 30 December 2017: 8x errors for "Parameter must be an array or an object that implements Countable"
  • 18 April 2018: 11x errors for "Parameter must be an array or an object that implements Countable"
1) ApiUserrightsTest::testAdd
count(): Parameter must be an array or an object that implements Countable
/home/travis/build/wikimedia/mediawiki/includes/specials/SpecialUserrights.php:462
/home/travis/build/wikimedia/mediawiki/includes/specials/SpecialUserrights.php:405
/home/travis/build/wikimedia/mediawiki/includes/api/ApiUserrights.php:116
/home/travis/build/wikimedia/mediawiki/includes/api/ApiMain.php:1579
/home/travis/build/wikimedia/mediawiki/includes/api/ApiMain.php:504
/home/travis/build/wikimedia/mediawiki/tests/phpunit/includes/api/ApiTestCase.php:144
/home/travis/build/wikimedia/mediawiki/tests/phpunit/includes/api/ApiTestCase.php:173
/home/travis/build/wikimedia/mediawiki/tests/phpunit/includes/api/ApiUserrightsTest.php:68
/home/travis/build/wikimedia/mediawiki/tests/phpunit/includes/api/ApiUserrightsTest.php:120
/home/travis/build/wikimedia/mediawiki/tests/phpunit/MediaWikiTestCase.php:421

2) ApiUserrightsTest::testBlockedWithUserrights
count(): Parameter must be an array or an object that implements Countable
/home/travis/build/wikimedia/mediawiki/includes/specials/SpecialUserrights.php:462
/home/travis/build/wikimedia/mediawiki/includes/specials/SpecialUserrights.php:405
/home/travis/build/wikimedia/mediawiki/includes/api/ApiUserrights.php:116
/home/travis/build/wikimedia/mediawiki/includes/api/ApiMain.php:1579
/home/travis/build/wikimedia/mediawiki/includes/api/ApiMain.php:504
/home/travis/build/wikimedia/mediawiki/tests/phpunit/includes/api/ApiTestCase.php:144
/home/travis/build/wikimedia/mediawiki/tests/phpunit/includes/api/ApiTestCase.php:173
/home/travis/build/wikimedia/mediawiki/tests/phpunit/includes/api/ApiUserrightsTest.php:68
/home/travis/build/wikimedia/mediawiki/tests/phpunit/includes/api/ApiUserrightsTest.php:130
/home/travis/build/wikimedia/mediawiki/tests/phpunit/MediaWikiTestCase.php:421

3) ApiUserrightsTest::testAddMultiple
count(): Parameter must be an array or an object that implements Countable
/home/travis/build/wikimedia/mediawiki/includes/specials/SpecialUserrights.php:462
/home/travis/build/wikimedia/mediawiki/includes/specials/SpecialUserrights.php:405
/home/travis/build/wikimedia/mediawiki/includes/api/ApiUserrights.php:116
/home/travis/build/wikimedia/mediawiki/includes/api/ApiMain.php:1579
/home/travis/build/wikimedia/mediawiki/includes/api/ApiMain.php:504
/home/travis/build/wikimedia/mediawiki/tests/phpunit/includes/api/ApiTestCase.php:144
/home/travis/build/wikimedia/mediawiki/tests/phpunit/includes/api/ApiTestCase.php:173
/home/travis/build/wikimedia/mediawiki/tests/phpunit/includes/api/ApiUserrightsTest.php:68
/home/travis/build/wikimedia/mediawiki/tests/phpunit/includes/api/ApiUserrightsTest.php:156
/home/travis/build/wikimedia/mediawiki/tests/phpunit/MediaWikiTestCase.php:421

4) ApiUserrightsTest::testWebToken
count(): Parameter must be an array or an object that implements Countable
/home/travis/build/wikimedia/mediawiki/includes/specials/SpecialUserrights.php:462
/home/travis/build/wikimedia/mediawiki/includes/specials/SpecialUserrights.php:405
/home/travis/build/wikimedia/mediawiki/includes/api/ApiUserrights.php:116
/home/travis/build/wikimedia/mediawiki/includes/api/ApiMain.php:1579
/home/travis/build/wikimedia/mediawiki/includes/api/ApiMain.php:504
/home/travis/build/wikimedia/mediawiki/tests/phpunit/includes/api/ApiTestCase.php:144
/home/travis/build/wikimedia/mediawiki/tests/phpunit/includes/api/ApiUserrightsTest.php:239
/home/travis/build/wikimedia/mediawiki/tests/phpunit/MediaWikiTestCase.php:421

5) ApiUserrightsTest::testAddAndRemoveGroups with data set "Simple add" (array(array('sysop'), array()), array(array('sysop'), array()), array('bot', 'sysop'))
count(): Parameter must be an array or an object that implements Countable
/home/travis/build/wikimedia/mediawiki/includes/specials/SpecialUserrights.php:462
/home/travis/build/wikimedia/mediawiki/includes/specials/SpecialUserrights.php:405
/home/travis/build/wikimedia/mediawiki/includes/api/ApiUserrights.php:116
/home/travis/build/wikimedia/mediawiki/includes/api/ApiMain.php:1579
/home/travis/build/wikimedia/mediawiki/includes/api/ApiMain.php:504
/home/travis/build/wikimedia/mediawiki/tests/phpunit/includes/api/ApiTestCase.php:144
/home/travis/build/wikimedia/mediawiki/tests/phpunit/includes/api/ApiTestCase.php:173
/home/travis/build/wikimedia/mediawiki/tests/phpunit/includes/api/ApiUserrightsTest.php:68
/home/travis/build/wikimedia/mediawiki/tests/phpunit/includes/api/ApiUserrightsTest.php:315
/home/travis/build/wikimedia/mediawiki/tests/phpunit/MediaWikiTestCase.php:421

6) ApiUserrightsTest::testAddAndRemoveGroups with data set "Simple remove" (array(array(), array('bot')), array(array(), array('bot')), array())
count(): Parameter must be an array or an object that implements Countable
/home/travis/build/wikimedia/mediawiki/includes/specials/SpecialUserrights.php:462
/home/travis/build/wikimedia/mediawiki/includes/specials/SpecialUserrights.php:405
/home/travis/build/wikimedia/mediawiki/includes/api/ApiUserrights.php:116
/home/travis/build/wikimedia/mediawiki/includes/api/ApiMain.php:1579
/home/travis/build/wikimedia/mediawiki/includes/api/ApiMain.php:504
/home/travis/build/wikimedia/mediawiki/tests/phpunit/includes/api/ApiTestCase.php:144
/home/travis/build/wikimedia/mediawiki/tests/phpunit/includes/api/ApiTestCase.php:173
/home/travis/build/wikimedia/mediawiki/tests/phpunit/includes/api/ApiUserrightsTest.php:68
/home/travis/build/wikimedia/mediawiki/tests/phpunit/includes/api/ApiUserrightsTest.php:315
/home/travis/build/wikimedia/mediawiki/tests/phpunit/MediaWikiTestCase.php:421

7) ApiUserrightsTest::testAddAndRemoveGroups with data set "Add and remove same new group" (null, array(array('sysop'), array('sysop')), array('bot', 'sysop'))
count(): Parameter must be an array or an object that implements Countable
/home/travis/build/wikimedia/mediawiki/includes/specials/SpecialUserrights.php:462
/home/travis/build/wikimedia/mediawiki/includes/specials/SpecialUserrights.php:405
/home/travis/build/wikimedia/mediawiki/includes/api/ApiUserrights.php:116
/home/travis/build/wikimedia/mediawiki/includes/api/ApiMain.php:1579
/home/travis/build/wikimedia/mediawiki/includes/api/ApiMain.php:504
/home/travis/build/wikimedia/mediawiki/tests/phpunit/includes/api/ApiTestCase.php:144
/home/travis/build/wikimedia/mediawiki/tests/phpunit/includes/api/ApiTestCase.php:173
/home/travis/build/wikimedia/mediawiki/tests/phpunit/includes/api/ApiUserrightsTest.php:68
/home/travis/build/wikimedia/mediawiki/tests/phpunit/includes/api/ApiUserrightsTest.php:315
/home/travis/build/wikimedia/mediawiki/tests/phpunit/MediaWikiTestCase.php:421

8) DBConnRefTest::testConstruct_failure
count(): Parameter must be an array or an object that implements Countable
/home/travis/build/wikimedia/mediawiki/includes/libs/rdbms/database/DBConnRef.php:36
/home/travis/build/wikimedia/mediawiki/tests/phpunit/includes/libs/rdbms/database/DBConnRefTest.php:106
/home/travis/build/wikimedia/mediawiki/maintenance/doMaintenance.php:94

9) BitmapMetadataHandlerTest::testMultilingualCascade
count(): Parameter must be an array or an object that implements Countable
/home/travis/build/wikimedia/mediawiki/includes/media/Exif.php:745
/home/travis/build/wikimedia/mediawiki/includes/media/Exif.php:336
/home/travis/build/wikimedia/mediawiki/includes/media/Exif.php:308
/home/travis/build/wikimedia/mediawiki/includes/media/BitmapMetadataHandler.php:91
/home/travis/build/wikimedia/mediawiki/includes/media/BitmapMetadataHandler.php:187
/home/travis/build/wikimedia/mediawiki/tests/phpunit/includes/media/BitmapMetadataHandlerTest.php:32
/home/travis/build/wikimedia/mediawiki/tests/phpunit/MediaWikiTestCase.php:421
/home/travis/build/wikimedia/mediawiki/maintenance/doMaintenance.php:94

10) ExifTest::testGPSExtraction
count(): Parameter must be an array or an object that implements Countable
/home/travis/build/wikimedia/mediawiki/includes/media/Exif.php:745
/home/travis/build/wikimedia/mediawiki/includes/media/Exif.php:336
/home/travis/build/wikimedia/mediawiki/includes/media/Exif.php:308
/home/travis/build/wikimedia/mediawiki/tests/phpunit/includes/media/ExifTest.php:24
/home/travis/build/wikimedia/mediawiki/tests/phpunit/MediaWikiTestCase.php:421
/home/travis/build/wikimedia/mediawiki/maintenance/doMaintenance.php:94

11) ExifTest::testUnicodeUserComment
count(): Parameter must be an array or an object that implements Countable
/home/travis/build/wikimedia/mediawiki/includes/media/Exif.php:745
/home/travis/build/wikimedia/mediawiki/includes/media/Exif.php:336
/home/travis/build/wikimedia/mediawiki/includes/media/Exif.php:308
/home/travis/build/wikimedia/mediawiki/tests/phpunit/includes/media/ExifTest.php:39
/home/travis/build/wikimedia/mediawiki/tests/phpunit/MediaWikiTestCase.php:421
/home/travis/build/wikimedia/mediawiki/maintenance/doMaintenance.php:94
Reedy created this task.Dec 8 2017, 2:50 AM
Restricted Application added projects: Commons, Multimedia. · View Herald TranscriptDec 8 2017, 2:50 AM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Reedy moved this task from Unsorted to PHP 7.2 on the [DO NOT USE] NewPHP board.Dec 8 2017, 2:56 AM

Change 396426 had a related patch set uploaded (by Anomie; owner: Anomie):
[mediawiki/core@master] ApiQueryBase: Fix addWhereFld for PHP 7.2

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

Anomie moved this task from Unsorted to Needs Review on the MediaWiki-API board.Dec 8 2017, 4:52 PM
Anomie moved this task from Needs Review to Done on the MediaWiki-API board.Dec 8 2017, 5:48 PM

Change 396426 merged by jenkins-bot:
[mediawiki/core@master] ApiQueryBase: Fix addWhereFld for PHP 7.2

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

Reedy updated the task description. (Show Details)Dec 30 2017, 2:08 AM
Reedy updated the task description. (Show Details)
Reedy updated the task description. (Show Details)

Change 400916 had a related patch set uploaded (by Reedy; owner: Reedy):
[mediawiki/core@master] Only run count() on array()

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

Krinkle updated the task description. (Show Details)Thu, Apr 19, 1:36 AM

Change 427580 had a related patch set uploaded (by Krinkle; owner: Krinkle):
[mediawiki/core@master] API: Fix PHP Warning for "count(): Parameter must be an array"

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

Change 427728 had a related patch set uploaded (by Krinkle; owner: Krinkle):
[mediawiki/core@master] userrights: Add array typehints to SpecialUserrights methods

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

Change 427729 had a related patch set uploaded (by Krinkle; owner: Krinkle):
[mediawiki/core@REL1_31] API: Fix PHP Warning for "count(): Parameter must be an array"

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

Change 427580 merged by jenkins-bot:
[mediawiki/core@master] API: Fix PHP Warning for "count(): Parameter must be an array"

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

Change 427729 merged by jenkins-bot:
[mediawiki/core@REL1_31] API: Fix PHP Warning for "count(): Parameter must be an array"

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