phpmyadmin - count(): Parameter must be an array o

2019-01-16 00:51发布

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?

23条回答
成全新的幸福
2楼-- · 2019-01-16 01:13

Proceed following steps at ubuntu-18.04:

Step 1) locate sql.lib.php

It will show something like:

/usr/share/phpmyadmin/libraries/sql.lib.php

Step 2) Open terminal (Alt t) and write:

sudo /usr/sbin/pma-configure

Step 3)sudo gedit /usr/share/phpmyadmin/libraries/sql.lib.php and search below function:

 

    function PMA_isRememberSortingOrder($analyzed_sql_results)
     {
        return $GLOBALS['cfg']['RememberSorting']
            && ! ($analyzed_sql_results['is_count']
                || $analyzed_sql_results['is_export']
                || $analyzed_sql_results['is_func']
                || $analyzed_sql_results['is_analyse'])
            && $analyzed_sql_results['select_from']
            && ((empty($analyzed_sql_results['select_expr']))
                || (count($analyzed_sql_results['select_expr'] == 1)
                    && ($analyzed_sql_results['select_expr'][0] == '*')))
            && count($analyzed_sql_results['select_tables']) == 1;
     }

Step 4) Replace above function with:


     function PMA_isRememberSortingOrder($analyzed_sql_results)
     {
        return $GLOBALS['cfg']['RememberSorting']
            && ! ($analyzed_sql_results['is_count']
                || $analyzed_sql_results['is_export']
                || $analyzed_sql_results['is_func']
                || $analyzed_sql_results['is_analyse'])
            && $analyzed_sql_results['select_from']
            && ((empty($analyzed_sql_results['select_expr']))
                || (count($analyzed_sql_results['select_expr']) == 1)
                    && ($analyzed_sql_results['select_expr'][0] == '*'))
            && count($analyzed_sql_results['select_tables']) == 1;
     }

Step 4) Save & close file and below command on terminal

sudo /usr/sbin/pma-secure

Step 5) sudo service mysql reload

Step 6) sudo service apache2 reload

It works for me.. Goodluck

查看更多
\"骚年 ilove
3楼-- · 2019-01-16 01:14

Edit file /usr/share/phpmyadmin/libraries/sql.lib.php:

sudo nano /usr/share/phpmyadmin/libraries/sql.lib.php

Replace: count($analyzed_sql_results['select_expr'] == 1)

With: (count($analyzed_sql_results['select_expr']) == 1)

Restart the server

sudo service apache2 restart
查看更多
在下西门庆
4楼-- · 2019-01-16 01:16
Works on UBUNTU 18.04 


Edit file: '/usr/share/phpmyadmin/libraries/sql.lib.php'
Replace: (count($analyzed_sql_results['select_expr'] == 1)
With:  ((count($analyzed_sql_results['select_expr']) == 1)

Restart the server
sudo service apache2 restart
查看更多
冷血范
5楼-- · 2019-01-16 01:16

Edit file '/usr/share/phpmyadmin/libraries/sql.lib.php' Replace: (make backup)

"|| (count($analyzed_sql_results['select_expr'] == 1) 
&&($analyzed_sql_results['select_expr'][0] == '*'))) 
&& count($analyzed_sql_results['select_tables']) == 1;"

With:

"|| (count($analyzed_sql_results['select_expr']) == 1) 
&& ($analyzed_sql_results['select_expr'][0] == '*') 
&& (count($analyzed_sql_results['select_tables']) == 1));"
查看更多
Viruses.
6楼-- · 2019-01-16 01:16

Edit file '/usr/share/phpmyadmin/libraries/sql.lib.php'

see error on your error

./libraries/sql.lib.php#2038: PMA_isRememberSortingOrder(array) ./libraries/sql.lib.php#1984: PMA_executeQueryAndGetQueryResponse(

go to this line and remove the function call.

It works for me. Thank you

查看更多
乱世女痞
7楼-- · 2019-01-16 01:18

On Ubuntu 18.04 with MariaDb and Nginx, I solved it with updating file /usr/share/phpmyadmin/libraries/sql.lib.php as follows:

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

The answer mentioned by @Nguyen throws a 500 error saying:

FastCGI sent in stderr: "PHP message: PHP Parse error:  syntax error, unexpected ')', expecting ';' in /usr/share/phpmyadmin/libraries/sql.lib.php on line 614"
查看更多
登录 后发表回答