Error count parameter must be an array or an object that implements countable

I've uploaded the backup to a table, opening the table I see this: Warning in ./libraries/sql.lib.php#601 count(): Parameter must be an array or an object that implements Countable Backtrace ./

I’ve uploaded the backup to a table, opening the table I see this:

Warning in ./libraries/sql.lib.php#601
count(): Parameter must be an array or an object that implements Countable

Backtrace

./libraries/sql.lib.php#2038: PMA_isRememberSortingOrder(array)
./libraries/sql.lib.php#1984: PMA_executeQueryAndGetQueryResponse(
array,
boolean true,
string 'alternativegirls',
string 'tgp_photo',
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
string '',
string './themes/pmahomme/img/',
NULL,
NULL,
NULL,
string 'SELECT * FROM `tgp_photo`',
NULL,
NULL,
)
./sql.php#216: PMA_executeQueryAndSendQueryResponse(
array,
boolean true,
string 'alternativegirls',
string 'tgp_photo',
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
string '',
string './themes/pmahomme/img/',
NULL,
NULL,
NULL,
string 'SELECT * FROM `tgp_photo`',
NULL,
NULL,
)
./index.php#53: include(./sql.php)

Inside phpMyAdmin…

PHP is 7.2, the server is Ubuntu 16.04, installed yesterday.

Looking for I saw that some have this error in their code, but I did not find anyone who received it in phpMyAdmin…

What should I do? Is that my error? A phpmyadmin error? wait update ? I go back to PHP 7.1?

(PHP 4, PHP 5, PHP 7, PHP 8)

countCounts all elements in an array or in a Countable object

Description

count(Countable|array $value, int $mode = COUNT_NORMAL): int

Parameters

value

An array or Countable object.

mode

If the optional mode parameter is set to
COUNT_RECURSIVE (or 1), count()
will recursively count the array. This is particularly useful for
counting all the elements of a multidimensional array.

Caution

count() can detect recursion to avoid an infinite
loop, but will emit an E_WARNING every time it
does (in case the array contains itself more than once) and return a
count higher than may be expected.

Return Values

Returns the number of elements in value.
Prior to PHP 8.0.0, if the parameter was neither an array nor an object that
implements the Countable interface,
1 would be returned,
unless value was null, in which case
0 would be returned.

Changelog

Version Description
8.0.0 count() will now throw TypeError on
invalid countable types passed to the value parameter.
7.2.0 count() will now yield a warning on invalid countable types
passed to the value parameter.

Examples

Example #1 count() example


<?php
$a
[0] = 1;
$a[1] = 3;
$a[2] = 5;
var_dump(count($a));$b[0] = 7;
$b[5] = 9;
$b[10] = 11;
var_dump(count($b));
?>

The above example will output:

Example #2 count() non Countable|array example (bad example — don’t do this)


<?php
$b
[0] = 7;
$b[5] = 9;
$b[10] = 11;
var_dump(count($b));var_dump(count(null));var_dump(count(false));
?>

The above example will output:

Output of the above example in PHP 7.2:

int(3)

Warning: count(): Parameter must be an array or an object that implements Countable in … on line 12
int(0)

Warning: count(): Parameter must be an array or an object that implements Countable in … on line 14
int(1)

Output of the above example in PHP 8:

int(3)

Fatal error: Uncaught TypeError: count(): Argument #1 ($var) must be of type Countable .. on line 12

Example #3 Recursive count() example


<?php
$food
= array('fruits' => array('orange', 'banana', 'apple'),
'veggie' => array('carrot', 'collard', 'pea'));// recursive count
var_dump(count($food, COUNT_RECURSIVE));// normal count
var_dump(count($food));?>

The above example will output:

Example #4 Countable object


<?php
class CountOfMethods implements Countable
{
private function
someMethod()
{
}

public function

count(): int
{
return
count(get_class_methods($this));
}
}
$obj = new CountOfMethods();
var_dump(count($obj));
?>

The above example will output:

See Also

  • is_array() — Finds whether a variable is an array
  • isset() — Determine if a variable is declared and is different than null
  • empty() — Determine whether a variable is empty
  • strlen() — Get string length
  • is_countable() — Verify that the contents of a variable is a countable value
  • Arrays

onlyranga at gmail dot com

8 years ago


[Editor's note: array at from dot pl had pointed out that count() is a cheap operation; however, there's still the function call overhead.]

If you want to run through large arrays don't use count() function in the loops , its a over head in performance,  copy the count() value into a variable and use that value in loops for a better performance.

Eg:

// Bad approach

for($i=0;$i<count($some_arr);$i++)

{

    // calculations

}

// Good approach

$arr_length = count($some_arr);

for($i=0;$i<$arr_length;$i++)

{

    // calculations

}


lucasfsmartins at gmail dot com

3 years ago


If you are on PHP 7.2+, you need to be aware of "Changelog" and use something like this:

<?php
$countFruits
= is_array($countFruits) || $countFruits instanceof Countable ? count($countFruits) : 0;
?>

You can organize your code to ensure that the variable is an array, or you can extend the Countable so that you don't have to do this check.


Anonymous

3 years ago


For a Non Countable Objects

$count = count($data);
print "Count: $countn";

Warning:  count(): Parameter must be an array or an object that implements Countable in example.php on line 159

#Quick fix is to just cast the non-countable object as an array.. 

$count = count((array) $data);
print "Count: $countn";

Count: 250


Christoph097

1 year ago


Empty values are counted:
<?php
$ar
[] = 3;
$ar[] = null;
var_dump(count($ar)); //int(2)
?>

danny at dannymendel dot com

15 years ago


I actually find the following function more useful when it comes to multidimension arrays when you do not want all levels of the array tree.

// $limit is set to the number of recursions

<?php

function count_recursive ($array, $limit) {

   
$count = 0;

    foreach (
$array as $id => $_array) {

        if (
is_array ($_array) && $limit > 0) {

           
$count += count_recursive ($_array, $limit - 1);

        } else {

           
$count += 1;

        }

    }

    return
$count;

}

?>


alexandr at vladykin dot pp dot ru

16 years ago


My function returns the number of elements in array for multidimensional arrays subject to depth of array. (Almost COUNT_RECURSIVE, but you can point on which depth you want to plunge).

<?php

 
function getArrCount ($arr, $depth=1) {

      if (!
is_array($arr) || !$depth) return 0;
$res=count($arr);

        
      foreach (

$arr as $in_ar)

        
$res+=getArrCount($in_ar, $depth-1);

     
      return

$res;

  }

?>


php_count at cubmd dot com

6 years ago


All the previous recursive count solutions with $depth option would not avoid infinite loops in case the array contains itself more than once.

Here's a working solution:

<?php

   
/**

     * Recursively count elements in an array. Behaves exactly the same as native

     * count() function with the $depth option. Meaning it will also add +1 to the

     * total count, for the parent element, and not only counting its children.

     * @param $arr

     * @param int $depth

     * @param int $i (internal)

     * @return int

     */

   
public static function countRecursive(&$arr, $depth = 0, $i = 0) {

       
$i++;

       
/**

         * In case the depth is 0, use the native count function

         */

       
if (empty($depth)) {

            return
count($arr, COUNT_RECURSIVE);

        }

       
$count = 0;

       
/**

         * This can occur only the first time when the method is called and $arr is not an array

         */

       
if (!is_array($arr)) {

            return
count($arr);

        }
// if this key is present, it means you already walked this array

       
if (isset($arr['__been_here'])) {

            return
0;

        }
$arr['__been_here'] = true;

        foreach (

$arr as $key => &$value) {

            if (
$key !== '__been_here') {

                if (
is_array($value) && $depth > $i) {

                   
$count += self::countRecursive($value, $depth, $i);

                }
$count++;

            }

        }
// you need to unset it when done because you're working with a reference...

       
unset($arr['__been_here']);

        return
$count;

    }

?>


pied-pierre

7 years ago


A function of one line to find the number of elements that are not arrays, recursively :

function count_elt($array, &$count=0){
  foreach($array as $v) if(is_array($v)) count_elt($v,$count); else ++$count;
  return $count;
}


Gerd Christian Kunze

9 years ago


Get maxWidth and maxHeight of a two dimensional array..?

Note:
1st dimension = Y (height)
2nd dimension = X (width)
e.g. rows and cols in database result arrays

<?php
$TwoDimensionalArray
= array( 0 => array( 'key' => 'value', ...), ... );
?>

So for Y (maxHeight)
<?php
$maxHeight
= count( $TwoDimensionalArray )
?>

And for X (maxWidth)
<?php
$maxWidth
= max( array_map( 'count'$TwoDimensionalArray ) );
?>

Simple? ;-)


buyatv at gmail dot com

6 years ago


You can not get collect sub array count when there is only one sub array in an array:

$a = array ( array ('a','b','c','d'));
$b = array ( array ('a','b','c','d'), array ('e','f','g','h'));

echo count($a);  // 4 NOT 1, expect 1
echo count($b);  // 2,   expected


JumpIfBelow

7 years ago


As I see in many codes, don't use count to iterate through array.
Onlyranga says you could declare a variable to store it before the for loop.
I agree with his/her approach, using count in the test should be used ONLY if you have to count the size of the array for each loop.

You can do it in the for loop too, so you don't have to "search" where the variable is set.
e.g.
<?php
    $array
= [1, 5, 'element'];
    for(
$i = 0, $c = count($array); $i < $c; $i++)
       
var_dump($array[$i]);
?>


jerome dot gds at gmail dot com

3 years ago


to end the debate: count() is the same as empty()

test code below:

results on my computer:

count : double(0.81396999359131)
empty : double(0.81621310710907)

using isset($test[0]) is a bit slower than empty;
test without adding value to the array in function ****Test: still the same.

<?phpfunction average(array $test)
{
   
$sum = 0;
    foreach(
$test as $value) {
       
$sum += $value;
    }

    return

$sum;
}

function

countTest(array $test)
{
   
$i = 0;
    while (
$i++ < 1000000) {
       
count($test);
       
$test["lol$i"] = "teset$i";
    }
}

function

emptyTest(array $test)
{
   
$i = 0;
    while (
$i++ < 1000000) {
        empty(
$test);
       
$test["lol$i"] = "teset$i";
    }
}
$test = [];
$i = 0;
while (
$i++ < 20000000) {
   
$test[] = $i;
}
$j = 10;
$value = $j;
$count = [];
$isEmpty = [];
while (
$j--) {
   
$time = microtime(true);
   
countTest($test);
   
$count[] = microtime(true) - $time;$time = microtime(true);
   
emptyTest($test);
   
$isEmpty[] = microtime(true) - $time;
}
var_dump(average($count) / $value);
var_dump(average($isEmpty) / $value);


buyatv at gmail dot com

6 years ago


You can not get collect sub array count when use the key on only one sub array in an array:

$a = array("a"=>"appple", b"=>array('a'=>array(1,2,3),'b'=>array(1,2,3)));
$b = array("a"=>"appple", "b"=>array(array('a'=>array(1,2,3),'b'=>array(1,2,3)), array(1,2,3),'b'=>array(1,2,3)), array('a'=>array(1,2,3),'b'=>array(1,2,3))));

echo count($a['b']);  // 2 NOT 1, expect 1
echo count($b['b']);  // 3,   expected


vojtaripa at gmail dot com

2 years ago


To get the count of the inner array you can do something like:

$inner_count = count($array[0]);
echo ($inner_count);


ThisIsNotImportant

7 years ago


About 2d arrays, you have many way to count elements :

<?php
$MyArray
= array ( array(1,2,3),
                  
1,
                  
'a',
                   array(
'a','b','c','d') );// All elements
echo count($MyArray ,COUNT_RECURSIVE);  // output 11 (9 values + 2 arrays)

// First level elements

echo count($MyArray );                  // output 4 (2 values+ 2 arrays)

// Both level values, but only values

echo(array_sum(array_map('count',$MyArray ))); //output 9 (9 values)

// Only second level values

echo (count($MyArray ,COUNT_RECURSIVE)-count($MyArray )); //output 7 ((all elements) - (first elements))
?>


asma mechtaba

10 months ago


count and sizeof are aliases, what work for one works for the other.

flavioaugusto dot br at gmail dot com

3 years ago


Criada para contar quantos níveis um array multidimensional possui.

function count_multiLevel($matrix, $_LEVEL = 0){

                /* Variáveis de recursão */
        $_COUNT = $_LEVEL;

                /* Verifica se o ARRAY foi instanciado */
        if (is_setVar($matrix)){

                        /* Verifica se a variável é um ARRAY */
            if(is_array($matrix)){

                                /* Loop de elementos da matriz*/
                foreach ($matrix as $elements => $value) {

                                        /* Auxiliar para verificação posterior */
                    $_AUX = $_COUNT;

                                        /* Verifiando os Nós */
                    if (is_array($matrix[$elements])) {
                        $_COUNT = count_multiLevel($matrix[$elements], $_LEVEL+1);   
                    }
                    /* Cereja do bolo */
                    if($_AUX > $_COUNT)
                        $_COUNT = $_AUX;
                }
                /* Retorn do resultado da operação */
                return $_COUNT;

                            }else{
                /* Em casos que o valor passado não seja uma matriz/array */
                return -1;
            }
        }
    }


max at schimmelmann dot org

2 years ago


In special situations you might only want to count the first level of the array to figure out how many entries you have, when they have N more key-value-pairs.

<?php

$data

= [
   
'a' => [
       
'bla1' => [
           
0 => 'asdf',
           
1 => 'asdf',
           
2 => 'asdf',
        ],
       
'bla2' => [
           
0 => 'asdf',
           
1 => 'asdf',
           
2 => 'asdf',
        ],
       
'bla3' => [
           
0 => 'asdf',
           
1 => 'asdf',
           
2 => 'asdf',
        ],
       
'bla4' => [
           
0 => 'asdf',
           
1 => 'asdf',
           
2 => 'asdf',
        ],
    ],
   
'b' => [
       
'bla1' => [
           
0 => 'asdf',
           
1 => 'asdf',
           
2 => 'asdf',
        ],
       
'bla2' => [
           
0 => 'asdf',
           
1 => 'asdf',
           
2 => 'asdf',
        ],
    ],
   
'c' => [
       
'bla1' => [
           
0 => 'asdf',
           
1 => 'asdf',
           
2 => 'asdf',
        ]
    ]
];
$count = array_sum(array_values(array_map('count', $data)));
// will return int(7)
var_dump($count);// will return 31
var_dump(count($data, 1));
?>


XavDeb

3 years ago


If you want to know the sub-array containing the MAX NUMBER of values in a 3 dimensions array, here is a try (maybe not the nicest way, but it works):

function how_big_is_the_biggest_sub ($array)  {
   // we parse the 1st level
   foreach ($array AS $key => $array_lvl2) {
         //within level 2, we count the 3d levels max
            $lvl2_nb = array_map( 'count',  $array_lvl2) ;
            $max_nb = max($lvl2_nb);
         // we store the matching keys, it might be usefull
            $max_key = array_search($max_nb, $lvl2_nb);
            $max_nb_all[$max_key.'|'.$key] = $max_nb;
        }
       // now we want the max from all levels 2, so one more time
        $real_max = max($max_nb_all);
        $real_max_key = array_search($real_max, $max_nb_all);
        list($real_max_key2, $real_max_key1) = explode('|', $real_max_key);
                // preparing result
        $biggest_sub['max'] = $real_max;
        $biggest_sub['key1'] = $real_max_key1;
        $biggest_sub['key2'] = $real_max_key2;

                return $biggest_sub;
}
/*
$cat_poids_max['M']['Juniors'][] = 55;
$cat_poids_max['M']['Juniors'][] = 61;
$cat_poids_max['M']['Juniors'][] = 68;
$cat_poids_max['M']['Juniors'][] = 76;
$cat_poids_max['M']['Juniors'][] = 100;

$cat_poids_max['M']['Seniors'][] = 55;
$cat_poids_max['M']['Seniors'][] = 60;
$cat_poids_max['M']['Seniors'][] = 67;
$cat_poids_max['M']['Seniors'][] = 75;
$cat_poids_max['M']['Seniors'][] = 84;
$cat_poids_max['M']['Seniors'][] = 90;
$cat_poids_max['M']['Seniors'][] = 100;
//....
$cat_poids_max['F']['Juniors'][] = 52;
$cat_poids_max['F']['Juniors'][] = 65;
$cat_poids_max['F']['Juniors'][] = 74;
$cat_poids_max['F']['Juniors'][] = 100;

$cat_poids_max['F']['Seniors'][] = 62;
$cat_poids_max['F']['Seniors'][] = 67;
$cat_poids_max['F']['Seniors'][] = 78;
$cat_poids_max['F']['Seniors'][] = 86;
$cat_poids_max['F']['Seniors'][] = 100;
*/
$biggest_sub = how_big_is_the_biggest_sub($cat_poids_max);
echo "<li> ".$biggest_sub['key1']." ==> ".$biggest_sub['key2']." ==> ".$biggest_sub['max']; // displays : M ==> Seniors ==> 7


Magento сыпет в логи такими ошибками:
ERR (3): Warning: count(): Parameter must be an array or an object that implements Countable in …/app/code/local/Mage/Catalog/Block/Product/List.php on line 299
Такой код:

/**
     * Retrieve block cache tags based on product collection
     *
     * @return array
     */
    public function getCacheTags()
    {
        $data = array(self::CACHE_TAG);
        if ($category = Mage::registry('current_category')) {
            $data[] = Mage_Catalog_Model_Category::CACHE_TAG . "_" . $category->getId();
        }
!!!Это строка 299 --->       if (count($products = $this->getProductList())) {
            foreach ($products as $p) {
                $data[] = Mage_Catalog_Model_Product::CACHE_TAG . "_" . $p->getId();
            }
        }
        return $data;
    }

    public function getCacheLifetime()
    {
        return ($this->getData('cache_lifetime'))?intval($this->getData('cache_lifetime')):3600;
    }
	
}

Я надеюсь есть несложный способ это устранить, подскажите.
Хорошего специалиста на подхвате нет, а малознакомым не доверяю, был печальный опыт, не раз. Здесь всё-таки сообщество интеллектуалов и коллективный разум…
А вообще да, еще проблема найти надежного и толкового админа/прогера на периодическую удаленную работу. У одних амбиции и запросы не ответствуют уровню, другие безответсвенные разгильдяи. К жалению на своем опыте это понял и излишнее доверие только усугубило ситуацию. Знаю что есть толковые ребята, но без соотвествующих знаний и опыта сложно сразу оценить профпригодность.
И это у меня средненький интернет-магазин, планы и потенциал для роста как у Наполеона, но к сожалению буксует все именно в человеческом факторе.

This is a very common error when we pass the non-array to count() function. You will get the exact same error message as below-

WARNING count(): Parameter must be an array or an object that implements Countable on line number 3
1

Suppose you have a variable called foo and you have initialized it by bar. Now if you will pass the foo to count() function, you will get the above warning.

<?php
	$foo = "bar";
	echo count($foo);

So the count() function in PHP will return the number of elements in an array. For the above example, $foo is not an array, and count() accepts the array as its parameter.

Also Read: Check if a string contains a specific word in PHP?

Never ever trust a variable type. You don’t know that your variable is an array or an object if you don’t explicitly declare it as an array or object.

Suppose you want to fetch all active user from the MySQL database and store it into the $active_user variable. But if there is no active user present and if you pass the $active_user to count($active_user), it will give you the above warning. So first check if the variable is an array or object.

How to check that?

If you are using PHP >= 7.3 you can use is_countable(). Check the below code:

Also Read: How to target a specific city to show your website in PHP?

if(is_countable($foo)) {
    echo count($foo);
}

If you are using PHP >= 7.1 you can use is_iterable(). Check the below code:

if(is_iterable($foo)) {
    echo count($foo);
}

A web developer who has a love for creativity and enjoys experimenting with the various techniques in both web designing and web development. If you would like to be kept up to date with his post, you can follow him.

Count(): Parameter must be an array or an object that implements Countable – What’s wrong?

When you implement some task with your files on localhost with XAMPP environment, have you ever faced the error Count(): Parameter must be an array or an object that implements Countable? We can understand that this error appears since there is an issue with the parameter which is passed to the count function.

Don’t worry about that because in the blog today, we would like to bring you some suggested solutions that you can try to solve this trouble. So, let’s dig in now!

Count(): Parameter Must Be An Array Or An Object That Implements Countable

How to fix the error Count(): Parameter must be an array or an object that implements Countable

As you know, from PHP 7.2 version, there is a warning on invalid countable types that are passed to the array_or_countable parameter. Therefore, in order to deal with this issue, you need to follow one of the three methods below:

  • Go to your localhost with XAMPP -> access the line that occurs the error -> replace the code:


$fcount = count($rawnames);

into:


$fcount = (is_array($rawnames)) ? count($rawnames) : 0;

  • Use a previous version of PHP instead of PHP 7.2.
  • Get in touch with the plugin support and ask for their support to tackle the error.

Wrap up

All in all, that are 3 solutions you should try to address the error Count(): Parameter must be an array or an object that implements Countable. We hope that the methods above will work successfully to help you remove the error. Any other solution to this trouble? If yes, don’t forget to share it with us by leaving your comment below. We will appreciate this.

Last but not least, we are providing many high-quality and fully responsive Joomla 4 Templates and Free WordPress Themes, so don’t hesitate to visit our site and get the best one whenever you want. Thanks for your reading and have a great day.

  • Author
  • Recent Posts

Lt Digital Team (Content &Amp; Marketing)

Welcome to LT Digital Team, we’re small team with 5 digital content marketers. We make daily blogs for Joomla! and WordPress CMS, support customers and everyone who has issues with these CMSs and solve any issues with blog instruction posts, trusted by over 1.5 million readers worldwide.

Lt Digital Team (Content &Amp; Marketing)

Как исправить ошибку в phpMyAdmin. «count(): Parameter must be an array or an object that implements Countable»

При установке phpMyAdmin на сервер с Debian 9 с установленной версией php7.3 может появиться ошибка count(): Parameter must be an array or an object that implements Countable. Возможно, в ближайшем будущем разработчики устранят эту ошибку, внеся исправления в официальный дистрибутив, но до сих пор для того, чтобы она не мешала работе, приходится устранять её ручками. Делать это достаточно просто. Как? Рассмотрим ниже.

Данная ошибка выдаётся в виде предупреждения, которое перекрывает весь экран:

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

Жалобы на работу скрипта plugin_interface.lib.php:

Warning in ./libraries/sql.lib.php#551
count(): Parameter must be an array or an object that implements Countable

Номер строки может варьироваться от версии phpMyAdmin.

Для того, чтобы продолжить работу, можно просто нажать на кнопку «Игнорировать всё» или «Игнорировать», но это не иправит ситуации и диалоговое окно:

На сервере обнаружены некоторые ошибки!
Пожалуйста, посмотрите вниз текущего окна.

всё равно будет появляться. Для того, чтобы данное сообщение не возникало, нужно внести небольшие правки в два файла phpMyAdmin в исходный код на сервере.

Исправления в файле sql.lib.php

Первое исправление нужно внести в файл /usr/share/phpmyadmin/libraries/sql.lib.php:

Находим в коде строку

|| (count($analyzed_sql_results['select_expr'] == 1)

и вместо неё вставляем строку

|| ((count($analyzed_sql_results['select_expr']) == 1)

Исправления в файле plugin_interface.lib.php

Второе исправление нужно внести в файл /usr/share/phpmyadmin/libraries/plugin_interface.lib.php:

Находим в коде строку

if ($options != null && count($options) > 0) {

и вместо неё вставляем строку

if ($options != null && count((array) $options) > 0) {

Резюме

После внесённых правок phpMyAdmin продолжает работать без ошибок:

Warning in ./libraries/sql.lib.php#551

Заберите ссылку на статью к себе, чтобы потом легко её найти!
Выберите, то, чем пользуетесь чаще всего:

When we recently changed our website’s PHP version from 7.1 to 7.3 , we started getting following error for one of our website,

 ERROR: ErrorException [ 2 ]: count(): Parameter must be an array or an object that implements Countable

When we searched into internet, found this error is related to operations on array in PHP and similar error also pointed out that “Parameter must be an array” .. to try and understand further, when we looked at the code in our website where this error has been reported, it was something like below,

<?if(count($ads)): 
    … some code … 
<?elseif (count($ads) == 0):?>
    … some code … 
<?if?>

As we looked further, we found that “$ads” is an array and “count($ads)” is trying to get the size of array or number of elements in this array.

Solution : use empty check on array instead of “count”

But there was one catch, $ads , the array was resulting as empty when some of our webpages were getting hit, so when count is called on this empty array i.e. count($ads) it was throwing an error as “count(): Parameter must be an array or an object that implements Countable” which is because count was getting called on empty array.

Hence once we changed our code to use “empty” API instead of “count” everything started working.. so our above code became as,

<?if( !empty($ads)):
    … some code … 
<?elseif (empty($ads)):?>
    … some code … 
<?if?> 

Comments

@philiplb

Daniel15

added a commit
to yarnpkg/release-infra
that referenced
this issue

Apr 11, 2018

@Daniel15

This was referenced

May 22, 2018

gitkv

added a commit
to gitkv/uniteller-php-sdk
that referenced
this issue

Jul 16, 2018

@gitkv

+recurrent tests
*refactoring signature
*refactoring http manager (providerError support csv)
*refactoring client
*soft fixes

+strict dependence on guzzle 6.3 (guzzle/guzzle#1973)

gitkv

added a commit
to gitkv/uniteller-php-sdk
that referenced
this issue

Jul 16, 2018

@gitkv

*client test
+recurrent payment (csv only)
+recurrent tests
*refactoring signature
*refactoring http manager (providerError support csv)
*refactoring client
*soft fixes
+strict dependence on guzzle 6.3 (guzzle/guzzle#1973)
*fix readme and example
+example useRecurrentPayment

gitkv

added a commit
to gitkv/uniteller-php-sdk
that referenced
this issue

Jul 17, 2018

@gitkv

*client test
+recurrent payment (csv only)
+recurrent tests
*refactoring signature
*refactoring http manager (providerError support csv)
*refactoring client
*soft fixes
+strict dependence on guzzle 6.3 (guzzle/guzzle#1973)
*fix readme and example
+example useRecurrentPayment
+fix for PR

This was referenced

Aug 25, 2018

soudai

added a commit
to soudai/mackerel-client-php
that referenced
this issue

Nov 20, 2018

@soudai

- count(): Parameter must be an array or an object that implements Countable
- guzzle/guzzle#1973

So give me the version of guzzlehttp

squatto

added a commit
to QuadraEcommerce/laravel-shipstation
that referenced
this issue

May 19, 2020

@squatto

discordier

added a commit
to phpcq/phpcq
that referenced
this issue

Jun 8, 2020

@discordier

dqwiki

added a commit
to UTRS2/utrs
that referenced
this issue

Oct 22, 2020

@dqwiki

kasperg

added a commit
to reload/ding2
that referenced
this issue

Jan 4, 2022

@kasperg

Otherwise we would be getting warnings: count(): Parameter must be an
array or an object that implements Countable in
GuzzleHttpHandlerCurlFactory->release()

This is fixed in
guzzle/guzzle#1973

6.3.3 is the last bugfix release for Guzzle 6.3.

kasperg

added a commit
to reload/ding2
that referenced
this issue

Jan 7, 2022

@kasperg

Otherwise we would be getting warnings: count(): Parameter must be an
array or an object that implements Countable in
GuzzleHttpHandlerCurlFactory->release()

This is fixed in
guzzle/guzzle#1973

6.3.3 is the last bugfix release for Guzzle 6.3.

kasperg

added a commit
to reload/ding2
that referenced
this issue

Jan 7, 2022

@kasperg

Otherwise we would be getting warnings: count(): Parameter must be an
array or an object that implements Countable in
GuzzleHttpHandlerCurlFactory->release()

This is fixed in
guzzle/guzzle#1973

6.3.3 is the last bugfix release for Guzzle 6.3.

kasperg

added a commit
to rvk-utd/ding2
that referenced
this issue

Apr 12, 2022

@kasperg

Otherwise we would be getting warnings: count(): Parameter must be an
array or an object that implements Countable in
GuzzleHttpHandlerCurlFactory->release()

This is fixed in
guzzle/guzzle#1973

6.3.3 is the last bugfix release for Guzzle 6.3.

Have you ever faced an error while uploading a logo, any image, or customer attribute image type from the admin side on Magento 2.3?

It says,

Warning: count(): Parameter must be an array or an object that implements Countable in Uploader.php on line 552 

If yes, relatable! I faced the error, fixed it, and am posting the solution here for my readers.

To solve the above error of Count(): Parameter must be an Array or an Object That Implements Countable in Magento 2.3, check the below solution:

Solution for Count(): Parameter must be an Array or an Object That Implements Countable in Magento 2.3

In the file-uploader.js, at pubstaticadminhtmlMagentobackenden_USMagento_Uijsformelement

Replace the code of function processFile with below code:

processFile: function (file) {

        file.previewType = this.getFilePreviewType(file);

        if (!file.id && file.name) {

            file.id = file.name;

        }

        this.observe.call(file, true, [

            ‘previewWidth’,

            ‘previewHeight’

        ]);

        return file;

    },

It is the pubstatic file, so you can check by updating quickly.

You also need to update the main file
vendormagentomodule-uiviewbasewebjsformelementfile-uploader.js

That’s it.

With the above method, you will get rid of the error.

However, you may face another error of Uncaught ReferenceError: Base64 is not Defined in Magento 2.3. Do not worry as I have posted the solution for the same.

Check – Solved: Uncaught ReferenceError: Base64 is not Defined in Magento 2.3

If you have any doubts regarding this error, do mention them in the Comment section below.

I would be happy to help.

Feel free to share the solution with Magento community via social media.

Thank you.

Solved: Count(): Parameter must be an Array or an Object That Implements Countable in Magento 2.3Author Magento Badge

An expert in his field, Jignesh is the team leader at Meetanshi and a certified Magento developer. His passion for Magento has inspired others in the team too. Apart from work, he is a cricket lover.

Понравилась статья? Поделить с друзьями:
  • Error count canon
  • Error couldn t resolve host name
  • Error couldn t open file
  • Error couldn t open display null glxgears
  • Error couldn t open custom hpk