I get this error in a script with count() after upgrade tot PHP 7.3
count(): Parameter must be an array or an object that implements Countable
How to solve…?
I get this error in a script with count() after upgrade tot PHP 7.3
count(): Parameter must be an array or an object that implements Countable
How to solve…?
Hi Bert, does this occur in one of your own scripts or in the generated code? See https://www.php.net/manual/en/migration72.incompatible.php
Hi Albert,
It happens on the production and not in development.
In this case when I use a count() in a script in a runbutton.
On internet it says:
count() throws a warning since PHP 7.2 in case a scalar or non-countable object is passed.
I am using in my run button script:
$aantal = count([checked_array]);
So the count of an array struggles. It was not in former PHP versions. This is not a bug in PHP but a feature it says.
The question is how to solve and why in production and not in development but this last is less important.
Regards Bert
Can you show the complete script? Maybe [checked_array] is not a array.
Ok alvagar,
In the onrecord of a runbutton:
$currentIndex = [current_index];
[checked_array][$currentIndex] = {id_orderregel};
[glob_id] = [checked_array][$currentIndex];
[current_index]++;
$aantal = count([checked_array]);
$i = 0;
while ($i < $aantal){
overnemenx();
$i++;
}
sc_reset_global([checked_array]);
Regards Bert
Hello,
if we start from the assumption that the count is zero, then we could believe that the array looks like a list,
could we not consider that no selection implies an exit from the calculation of the index,
or, a possibility would be to count the value 0 as 1, the value 1 as two, etc,
this way you will always have an array with the value 0 for 1, and take it into account in dependent requests by deducting 1 from the count
How are you declaring and initializing the variables?
Anyway, you can to validate if is an array:
if ( is_array( [checked_array]) ) {
…
}
This night (after a bad sleep) I got the (briljant) idea tot host the whole application on a hostserver from scriptcase, the most simple one. Then because they set it up the problems would show. Everything is working fine now. So it must be my production server. I have have spend many hours to setup etc…Still I donot know what it is. But I will not give up…Thanks so far.
i have read on internet the prob comes from phpmyadmin,
for info
https://medium.com/@chaloemphonthipkasorn/fix-bug-phpmyadmin-sql-lib-php-php7-2-ubuntu-16-04-836049630a40
it is true that I have been on a scriptcase development server for a very long time, the settings are very complete