Can anyone identify what needs to be changed to stop this php warning in Curly's nws-alerts.php script?
"PHP Warning: count(): Parameter must be an array or an object that implements Countable in C:\\www\\nws-alerts.php on line 581"
There has been a change in PHP starting with version 7.2 that is discussed here: http://php.net/manual/en/migration72.incompatible.php
My concern is that PHP will eventually disallow this use of count() altogether rendering the script useless without a fix. Thoughts?
it is always EXTREMELY helpful to have a link to the site / script.There are numerous versions and they can be customized also.
But those scripts have a
?sce=view so anyone who wants to help can check and see the offending line.
Probably it is this line:
$icount = count($bigIcos);
That variable $bigIcos is initialised a few lines before as
$bigIcos = '';
Up until 7.2, PHP was a loosely typed language and the PHP parser would convert that string to an empty array.
Not anymore, you will find numerous errors like these and others when converting these scripts to 7.2.
Other warnings/notices
A non-numeric value encountered in and
string to array For the "it is not an array" errors add a line similar to this one, just before the error
if (!is_array($bigIcos) ) {$bigIcos = array();}
For "A non-numeric value" error change the variable-definition, often at lines 117-127 of the script, from
$cmyzc = '';
to
$cmyzc = 0;
Wim
P.S. latest version of nws-alerts.php is
Version 1.37 - 03-Aug-2016 Add file get contents if cURL is not available
But that one returns the same notices/warnings.