Page MenuHomePhabricator

[API] PHP Warning: count(): Parameter must be an array or an object that implements Countable in PHP 7.2
Closed, ResolvedPublic

Description

A few days ago, I upgraded from php7.1 to php7.2. I found the core a problem.

PHP Warning:  count(): Parameter must be an array or an object that implements Countable in /InstallPath/includes/api/ApiQueryBase.php on line 269

In PHP 7.2, count() function does not accept non-countable types.

My wiki info are:

MediaWiki1.29.1
PHP7.2.0 (cgi-fcgi)
MariaDB10.2.11-MariaDB-log
ICU52.1
Lua5.1.5

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptDec 4 2017, 4:42 PM
Aklapper moved this task from Unsorted to PHP 7.2 on the [DO NOT USE] NewPHP board.Dec 4 2017, 5:10 PM
Aklapper added a project: MediaWiki-API.

Assuming includes/api/ApiQueryBase.php is MediaWiki-API

Anomie added a subscriber: Anomie.Dec 4 2017, 6:00 PM

It would be a lot more helpful if you could post line numbers from master rather than 1.29.

Change 395064 had a related patch set uploaded (by Anomie; owner: Anomie):
[mediawiki/core@master] API: Account for PHP 7.2 change

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

Anomie claimed this task.Dec 4 2017, 6:46 PM
Anomie moved this task from Unsorted to Needs Review on the MediaWiki-API board.

It would be a lot more helpful if you could post line numbers from master rather than 1.29

I will pay attention later. :D
In addition, is there any plan to make MW1.30 support PHP 7.2?

Reedy added a subscriber: Reedy.Dec 4 2017, 11:55 PM

It would be a lot more helpful if you could post line numbers from master rather than 1.29

I will pay attention later. :D
In addition, is there any plan to make MW1.30 support PHP 7.2?

No, and we don't generally backport "features"... 1.31 (next LTS, if we do it) should probably mostly support 7.2

If something is massively broken, we will potentially backport fixes though

Change 395064 merged by jenkins-bot:
[mediawiki/core@master] API: Account for PHP 7.2 change

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

RazeSoldier renamed this task from PHP Warning: count(): Parameter must be an array or an object that implements Countable in PHP 7.2 to [API] PHP Warning: count(): Parameter must be an array or an object that implements Countable in PHP 7.2.Dec 5 2017, 8:21 AM
Anomie closed this task as Resolved.Dec 5 2017, 1:15 PM

Note you'll need to update your MediaWiki installation to get the fix, or backport the change yourself if you want to continue using PHP 7.2 with older versions of MediaWiki.

It would be a lot more helpful if you could post line numbers from master rather than 1.29

I will pay attention later. :D
In addition, is there any plan to make MW1.30 support PHP 7.2?

No, and we don't generally backport "features"... 1.31 (next LTS, if we do it) should probably mostly support 7.2
If something is massively broken, we will potentially backport fixes though

I do not think this is a "feature", just a bug fixed. There should be no reason not to release this change in 1.30.1.