sql - 参数必须是在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,
)
解决方案
这似乎是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 ) 函数,该函数有效。
推荐阅读
- python - 六边形网格到方形网格的插值
- python - locale.Error:Android 上不支持的区域设置
- java - 插入单个数据库记录失败时是否需要回滚?
- c++ - 如何从 C++ 文件中提取不同 clang AST 节点的名称?
- ffmpeg - ffmpeg 使用覆盖时使视频倒置
- android - Firebase 身份验证:Facebook 登录在特定设备上出现哈希错误
- python - 通过 pm2 运行时的 Python 导入问题
- c# - PInvoke FatalExecutionEngineError 在不同的线程中
- django - django save 方法不会触发 post_save 信号
- java - 如何在一个循环中更改主要活动 android 几个按钮?