Bug #13118

Avoid PHP Warning: count(): Parameter must be an array or an object that implements Countable

Added by José Raddaoui Marín 3 months ago. Updated 2 months ago.

Status:NewStart date:07/23/2019
Priority:MediumDue date:
Assignee:José Raddaoui Marín% Done:

0%

Category:Internals
Target version:Release 2.6.0
Google Code Legacy ID: Tested version:
Sponsored:No Requires documentation:

Description

In PHP 7.2, count() will throw a warning on invalid countable types:

https://www.php.net/manual/en/function.count.php#refsect1-function.count-changelog

We should try to avoid that warning as it may lead to unexpected issues in the future. For example (the latest count in):

https://github.com/artefactual/atom/blob/stable/2.5.x/plugins/sfEadPlugin/modules/sfEadPlugin/templates/indexSuccessBodyDidElement.xml.php#L137

count_warnings.png (194 KB) José Raddaoui Marín, 08/07/2019 05:25 AM

History

#1 Updated by José Raddaoui Marín 3 months ago

See https://stackoverflow.com/questions/49662029/count-emitting-an-e-warning for more info on why this could be a problem and possible solutions.

Also available in: Atom PDF