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

Aklapper added a project: MediaWiki-Action-API.

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

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

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?

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

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.