6
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Ubuntu18.04 の phpmyadmin のエラーを直す

Last updated at Posted at 2020-04-02

image.png


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,
・・・・・・

環境

  • Ubuntu 18.04
  • phpMyAdmin 4.6.6 documentation
  • MariaDB mysql Ver 15.1 Distrib 10.1.44-MariaDB,
  • PHP 7.2

上記全てディストリビューションの標準パッケージでインストールしています。

解決方法の選択

この問題は、4.7.4の phpmyadmin で対応できているらしいです。
https://www.phpmyadmin.net/news/2017/8/24/phpmyadmin-474-released/

最新の公式パッケージをインストールするなどの方法もありますが、
今回は、インストールされている php スクリプトを書き換えることで対応します。

書き換え方法

以下を元にして対応しました。


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

613行目近辺


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;
}

の、


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

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

に直して解決します。

ここの count 関数が括弧で閉じてないのが原因だそうです。

6
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?