Closed davecarlson closed 5 years ago
Hi Dave,
thanks for reporting me that count() behaviour change in PHP 7.2 and plugin issue. I could not replicate that issue and wonder, because that object, that caused the error, should always be an countable object. So something went wrong or I missed an none default situation. Anyway, I will role out an update this week. Thanks!
Cheers, Johann
Reference to the warning on line 385 in acf-table-v5.php.
If there is a situation where count($a['b'])
is null
it gives you the new PHP 7.2 warning.
http://php.net/manual/en/function.count.php#refsect1-function.count-examples.
So changing line 385 from
if (count($a['b']) > 0)
to
if (null !== $a['b'] && count($a['b']) > 0)
does the trick.
In previous PHP versions count(NULL)
returned 0 without any warnings.
Hello, actually there should never be a situation in which the body data is zero. The table editor ensures that there is always at least one empty cell. Therefore, I am interested in what leads to this problem?
Yeah, i found a empty table what gives me null
.
After saving the page again the warning disappears.
This empty table was created (dev environment) on december the 7th 2017.
I can't replicate the issue for new (empty) tables anymore.
Thanks for the info.
I also get this error on one of my sites, has it been patched or is there a fix?
count(): Parameter must be an array or an object that implements Countable in /.../plugins/advanced-custom-fields-table-field/acf-table-v5.php on line 488
array_push() expects parameter 1 to be array, null given in /.../plugins/advanced-custom-fields-table-field/acf-table-v5.php on line 495
count(): Parameter must be an array or an object that implements Countable in /var/www/html/web/app/plugins/advanced-custom-fields-table-field/acf-table-v5.php on line 385
http://php.net/manual/en/migration72.incompatible.php