添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
高大的手术刀  ·  "夹缝男孩"回家·  6 月前    · 
大气的单杠  ·  Is not assignable to ...·  7 月前    · 
卖萌的饼干  ·  福州地铁6号线_百度百科·  7 月前    · 

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 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

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