首页 > 解决方案 > 参数必须是在phpmyadmin中实现Countable的数组或对象

问题描述

当我尝试在 phpmyadmin 中查看 wp_posts 表时,我看到了此错误消息,但不知道它的含义并且以前从未见过它。

有人可以帮助我尝试以某种方式摆脱它吗?

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

Backtrace

./libraries/sql.lib.php#2128: PMA_isRememberSortingOrder(array)
./libraries/sql.lib.php#2079: PMA_executeQueryAndGetQueryResponse(
array,
boolean true,
string 'afterhours',
string 'wp_posts',
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
string '',
string './themes/original/img/',
NULL,
NULL,
NULL,
string 'SELECT * FROM `wp_posts`',
NULL,
NULL,
)
./sql.php#221: PMA_executeQueryAndSendQueryResponse(
array,
boolean true,
string 'afterhours',
string 'wp_posts',
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
string '',
string './themes/original/img/',
NULL,
NULL,
NULL,
string 'SELECT * FROM `wp_posts`',
NULL,
NULL,
)

标签: sqlwordpress

解决方案


这似乎是phpmyadmin - count() 的副本:Parameter must be an array or an object that implements Countable

根据链接帖子上的最佳答案,看起来 ./libraries/sql.lib.php 中可能存在错误,导致代码尝试对数组(或实现“可数”的对象)。要修复它(根据链接的响应):

编辑文件'/usr/share/phpmyadmin/libraries/sql.lib.php'并替换

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

和:

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

这有效,因为:

  • 无法对非数组执行计数(因此您的错误,“参数必须是实现可计数的数组或对象”)
  • count() 中的“== 1”是等效测试,而不是数组
  • 从 count() 中删除 "== 1" 会留下一个 count( array ) 函数,该函数有效。

推荐阅读