我已经上传了备份到一个表,打开表我看到这个:

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

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

我看到一些人在他们的代码中有这个错误,但我没有发现任何人在phpMyAdmin中收到它…

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


当前回答

这对我很管用;

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

线路:614

替换两个代码:

替换:

(count($analyzed_sql_results[‘select_expr’] == 1)

:

(count($analyzed_sql_results[‘select_expr’]) == 1)

AND

替换:

($analyzed_sql_results[‘select_expr’][0] == ‘*’)))

:

($analyzed_sql_results[‘select_expr’][0] == ‘*’))

保存,退出并运行

sudo service apache2 restart

其他回答

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

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

按ctrl+w搜索(count($analyzed_sql_results['select_expr'] == 1)

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

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

重新启动服务器

 sudo service apache2 restart

此外,如果你仍然面临同样的问题,那么就做下面的事情。

打开/usr/share/phpmyadmin/libraries/plugin_interface.lib.php文件

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

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

Ctrl+w : if ($options != null && count($options) > 0) {

替换为以下代码

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

现在保存并重新启动服务器

sudo /etc/init.d/apache2 restart

最简单的方法:

只需在终端的命令行下面运行这个,然后回到PhpMyAdmin。

sudo sed -i "s/|\s*\((count(\$analyzed_sql_results\['select_expr'\]\)/| (\1)/g" /usr/share/phpmyadmin/libraries/sql.lib.php

手动方法:

打开sql.lib.php文件

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

查找文件中的count($analyzed_sql_results['select_expr']代码。您可以在第613行得到这一点。您可以在下面看到错误的代码

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

把错误的代码替换成下面这个

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

保存文件并进入PhpMyAdmin。

phpmyadmin 4.7.4应该有“修复了与PHP 7.2的几个兼容性问题”

您可能有一个较旧版本的phpmyadmin。

https://www.phpmyadmin.net/news/2017/8/24/phpmyadmin-474-released/

编辑/usr/share/phpmyadmin/libraries/sql.lib.php文件 (备份)

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

:

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

对于我的phpmyadmin版本(4.6.6deb5),我找到了第613行,并意识到count()括号没有正确关闭。要在下次发布之前暂时修复这个问题,只需更改:

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

to:

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