Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I'm getting issue with PhpMyAdmin when exporting any database. It is coming every time.

enter image description here

Please help me if anyone has solution to resolve all these types of issues in PhpMyAdmin

like image 759
Lakhwinder Singh Avatar asked Sep 13 '18 06:09

Lakhwinder Singh


4 Answers

It seems we can't remove all the issues from PhpMyAdmin with PHP 7.2+. But we can remove this issue by change in one line in file libraries/plugin_interface.lib.php file at line no 532.

Below is the screenshot for the fix.

Before fix code looks like:-

enter image description here

After fix code looks like:-

enter image description here

Above is the only fix to solve error messages in export database screen.

like image 155
Lakhwinder Singh Avatar answered Nov 13 '22 22:11

Lakhwinder Singh


Ubuntu 18.04 LTS

These are the steps which worked for me. Many, many thanks to William Desportes for providing the automatic updates on their Ubuntu PPA.

Step 1 (from William Desportes post)

sudo add-apt-repository ppa:phpmyadmin/ppa

Step 2

sudo apt-get --with-new-pkgs upgrade

Step 3

sudo service mysql restart

If you have issues restarting mysql, you can also restart with the following sequence

sudo service mysql stop

sudo service mysql start

like image 26
Ali Gökkaya Avatar answered Nov 13 '22 20:11

Ali Gökkaya


Yes if you're using phpMyAdmin version 4.6.6deb4, you'll get this error.

In my /usr/share/libraries/phpmyadmin/sql.lib.php file, on line 613 specifically, there seems to be an error in the if statement. Change

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

to this

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

The first code line is attempting to count the result of a boolean expression with outputs a non-countable value ('false' or 'true').

After this change, the error went away.

like image 9
marvatron Avatar answered Nov 13 '22 22:11

marvatron


After testing it on PHP 7.2.10 you need to change that line like this:

if ($options != null && count(array($options)) > 0) {
like image 2
Koenigsson Avatar answered Nov 13 '22 20:11

Koenigsson