phpmyadmin - count(): 参数必须是一个数组或者一个实现了Countable的对象

2022-01-05 00:00:00 php phpmyadmin 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

./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)

在 phpMyAdmin 中...

Inside phpMyAdmin...

PHP 是 7.2,服务器是 Ubuntu 16.04,昨天安装的.

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

寻找我看到有些人在他们的代码中有这个错误,但我没有找到任何人在phpMyAdmin中收到它...

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

我该怎么办?那是我的错误吗?phpmyadmin 错误?等待更新?我要回到 PHP 7.1?

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

推荐答案

Edit file /usr/share/phpmyadmin/libraries/sql.lib.php 使用以下命令:

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

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

在 613 行中,由于 $analyzed_sql_results['select_expr'] 之后没有右括号,count 函数的计算结果始终为真.进行以下替换可以解决此问题,然后您需要删除 614 行的最后一个右括号,因为它现在是一个额外的括号.

On line 613 the count function always evaluates to true since there is no closing parenthesis after $analyzed_sql_results['select_expr']. Making the below replacements resolves this, then you will need to delete the last closing parenthesis on line 614, as it's now an extra parenthesis.

替换:

((empty($analyzed_sql_results['select_expr']))
    || (count($analyzed_sql_results['select_expr'] == 1)
        && ($analyzed_sql_results['select_expr'][0] == '*')))

与:

((empty($analyzed_sql_results['select_expr']))
    || (count($analyzed_sql_results['select_expr']) == 1)
        && ($analyzed_sql_results['select_expr'][0] == '*'))

重启服务器apache:

Restart the server apache:

sudo service apache2 restart

相关文章