- Saved searches
- Use saved searches to filter your results more quickly
- Warning in ./libraries/sql.lib.php#613 count(): Parameter must be an array or an object that implements Countable #15574
- Warning in ./libraries/sql.lib.php#613 count(): Parameter must be an array or an object that implements Countable #15574
- Comments
- Describe the bug
- To Reproduce
- Expected behavior
- Screenshots
- Server configuration
- Client configuration
- Additional context
- Describe the bug
- To Reproduce
- Expected behavior
- Screenshots
- Server configuration
- Client configuration
- Additional context
- Problem with phpMyAdmin and PHP 7.2: “Warning in ./libraries/sql.lib.php#613 count(): Parameter must be an array or an object that implements Countable”
- sql.lib.php
- Import/Export issues
- Upgrading phpMyAdmin
- Как исправить ошибку в phpMyAdmin. «count(): Parameter must be an array or an object that implements Countable»
- Код ошибки count(): Parameter must be an array or an object that implements Countable
- Исправления в файле sql.lib.php
- Исправления в файле plugin_interface.lib.php
- Установка PhpMyAdmin Ubuntu 18.04
- Исправление ошибок
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Warning in ./libraries/sql.lib.php#613 count(): Parameter must be an array or an object that implements Countable #15574
Warning in ./libraries/sql.lib.php#613 count(): Parameter must be an array or an object that implements Countable #15574
Comments
Describe the bug
Each time I switch between tables in a list for a current database I get a warning «Warning in ./libraries/sql.lib.php#613 count(): Parameter must be an array or an object that implements Countable»
To Reproduce
Steps to reproduce the behavior:
- Login to PMA as a database user
- Choose any of your databases to expand a list of its tables
- Click on any table to view its contents
- See warning
Expected behavior
An expected behavior is to see database table contents without any warnings
Screenshots
Server configuration
- Operating system: Linux Mint 19.2
- Web server: Apache 2.4.29
- Database version: 5.7.27
- PHP version: 7.2.24
- phpMyAdmin version: 4.6.6deb5
Client configuration
Additional context
The bug is in the line 613 of a file ./libraries/sql.lib.php
The closing bracket of a count() function is misplaced and should be located before the «= auto»>What we have now:
The text was updated successfully, but these errors were encountered:
Hello @VikMuss this issue is already patched, we are working on packaging a new version on debian (#15236) and if you use Ubuntu you can use our PPA before Ubuntu has the version we build on Debian (#15515)
Thank you for reporting the issue
You’re always welcome, sir! 🙂
Thanks for the information. Have a lovely day
Describe the bug
Each time I switch between tables in a list for a current database I get a warning «Warning in ./libraries/sql.lib.php#613 count(): Parameter must be an array or an object that implements Countable»
To Reproduce
- Login to PMA as a database user
- Choose any of your databases to expand a list of its tables
- Click on any table to view its contents
- See warning
Expected behavior
An expected behavior is to see database table contents without any warnings
Screenshots
Server configuration
- Operating system: Linux Mint 19.2
- Web server: Apache 2.4.29
- Database version: 5.7.27
- PHP version: 7.2.24
- phpMyAdmin version: 4.6.6deb5
Client configuration
Additional context
The bug is in the line 613 of a file ./libraries/sql.lib.php
The closing bracket of a count() function is misplaced and should be located before the «= auto»>What we have now:
How it should be:
Hy it worked for me thank you
Problem with phpMyAdmin and PHP 7.2: “Warning in ./libraries/sql.lib.php#613 count(): Parameter must be an array or an object that implements Countable”
These errors occur if your version of phpMyAdmin is not compatible with your version of PHP. For example, when PHP 7.2 was released, there were compatibility issues with some phpMyAdmin versions in the repository (phpMyAdmin v4.6.x). You can either resolve these issues by manually upgrading phpMyAdmin or you can instead alter some lines of code in phpMyAdmin to temporarily resolve the issue.
sql.lib.php
This error is caused by a line of code in /usr/share/phpmyadmin/libraries/sql.lib.php .
If you don’t want to wait for the repositories to update with the latest version, it is strongly recommended that you manually upgrade to the latest version of phpMyAdmin yourself.
Alternatively, you can make a change to sql.lib.php to temporarily fix the error.
Firstly, backup sql.lib.php before editing.
sudo cp /usr/share/phpmyadmin/libraries/sql.lib.php /usr/share/phpmyadmin/libraries/sql.lib.php.bak
sudo nano /usr/share/phpmyadmin/libraries/sql.lib.php
Press CTRL + W and search for (count($analyzed_sql_results[‘select_expr’] == 1)
Replace it with ((count($analyzed_sql_results[‘select_expr’]) == 1)
Save file and exit. (Press CTRL + X , press Y and then press ENTER )
Import/Export issues
If you are also getting an error Warning in ./libraries/plugin_interface.lib.php#551 under import and export tabs:
sudo cp /usr/share/phpmyadmin/libraries/plugin_interface.lib.php /usr/share/phpmyadmin/libraries/plugin_interface.lib.php.bak
sudo nano /usr/share/phpmyadmin/libraries/plugin_interface.lib.php
Press CTRL + W and search for if (! is_null($options) && count($options) > 0)
If not found, try search for if ($options != null && count($options) > 0)
Replace with if (! is_null($options) && count((array)$options) > 0)
Save file and exit. (Press CTRL + X , press Y and then press ENTER )
Upgrading phpMyAdmin
You may be interested in an article I wrote on manually upgrading phpMyAdmin. Since the release of Ubuntu 18.04, the repositories have been slow to update with the latest version of phpMyAdmin causing many compatibility issues, so make sure you have the latest version:
Let me know if this helped. Follow me on Twitter, Facebook and YouTube, or 🍊 buy me a smoothie.
p.s. I increased my AdSense revenue by 200% using AI 🤖. Read my Ezoic review to find out how.
Как исправить ошибку в phpMyAdmin. «count(): Parameter must be an array or an object that implements Countable»
При установке phpMyAdmin на сервер с Debian 9 с установленной версией php7.3 может появиться ошибка count(): Parameter must be an array or an object that implements Countable . Возможно, в ближайшем будущем разработчики устранят эту ошибку, внеся исправления в официальный дистрибутив, но до сих пор для того, чтобы она не мешала работе, приходится устранять её ручками. Делать это достаточно просто. Как? Рассмотрим ниже.
Код ошибки count(): Parameter must be an array or an object that implements Countable
Данная ошибка выдаётся в виде предупреждения, которое перекрывает весь экран:
Жалобы на работу скрипта plugin_interface.lib.php :
Warning in ./libraries/sql.lib.php#551 count(): Parameter must be an array or an object that implements Countable
Номер строки может варьироваться от версии phpMyAdmin.
Для того, чтобы продолжить работу, можно просто нажать на кнопку «Игнорировать всё» или «Игнорировать», но это не иправит ситуации и диалоговое окно:
На сервере обнаружены некоторые ошибки! Пожалуйста, посмотрите вниз текущего окна.
всё равно будет появляться. Для того, чтобы данное сообщение не возникало, нужно внести небольшие правки в два файла phpMyAdmin в исходный код на сервере.
Исправления в файле sql.lib.php
Первое исправление нужно внести в файл /usr/share/phpmyadmin/libraries/sql.lib.php :
|| (count($analyzed_sql_results['select_expr'] == 1)
и вместо неё вставляем строку
|| ((count($analyzed_sql_results['select_expr']) == 1)
Исправления в файле plugin_interface.lib.php
Второе исправление нужно внести в файл /usr/share/phpmyadmin/libraries/plugin_interface.lib.php :
if ($options != null && count($options) > 0)
и вместо неё вставляем строку
if ($options != null && count((array) $options) > 0)
Резюме
После внесённых правок phpMyAdmin продолжает работать без ошибок:
Заберите ссылку на статью к себе, чтобы потом легко её найти!
Раз уж досюда дочитали, то может может есть желание рассказать об этом месте своим друзьям, знакомым и просто мимо проходящим?
Не надо себя сдерживать! 😉
Issue with phpMyAdmin and PHP: Warning in ./libraries/sql.lib.php#613 count(): Parameter must be an array or an object that implements Countable”
Today, I had installed PHP 7.3 and phpMyAdmin on Ubuntu 18.04 LTS system. I am using MariaDB as database server running on the same instance. When I tried to access data in tables using phpMyAdmin got the following error message on screen.
Warning in ./libraries/sql.lib.php#613 count(): Parameter must be an array or an object that implements Countable”
Solution:
It looks issue is due to older version of phpMyAdmin. The version of phpMyAdmin is older before the release of PHP 7.3 and it not properly compatible with that.
In order to resolve, we recommend to upgrade the phpMyAdmin version. But you can make changes in sql.lib.php to temporarily resolve this error.
- Make a backup of sql.lib.php
sudo cp /usr/share/phpmyadmin/libraries/sql.lib.php /usr/share/phpmyadmin/libraries/sql.lib.php.bak
sudo nano /usr/share/phpmyadmin/libraries/sql.lib.php
All done. The error message should disappear now.
Установка PhpMyAdmin Ubuntu 18.04
В данной статье мы затронем процесс установки PhpMyAdmin. Данная статья является продолжением предыдущей статьи, в которой мы устанавливали веб сервер.
Для начала необходимо запустить терминал и обновить индекс пакетов. Для этого введем следующую команду:
После этого запустим установку phpmyadmin следующей командой:
sudo apt install phpmyadmin php-mbstring php-gettext
В открывшемся окне нажав клавишу пробел выберем apache2 и нажмем ok. В следующем окне на вопрос "Настроить базу данных для phpmyadmin?" выбираем нет.
Далее проверим работоспособность phpmyadmin. Для этого откроем браузер и перейдем по следующему адресу:
Должно открыться окно входа в phpmyadmin. Но если мы попробуем войти от пользователя root, то получим ошибку доступа.
Для того, чтобы разблокировать вход в phpmyadmin необходимо изменить метод в хода. Для этого в терминале откроем оболочку mysql, следующей командой:
Далее выведем список пользователей следующей командой:
SELECT user,authentication_string,plugin,host FROM mysql.user;
У пользователя root используется метод входа auth_socket. Нам же необходимо изменить метод входа по паролю. Чтобы изменить метод входа введем следующую команду в терминале:
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
В выражении BY 'password' вместо 'password' укажем нужный пароль.
Далее обновим привелегии пользователя следующей командой:
Закрываем оболочку командой:
Проверим возможность входа пользователя root. Вернемся в браузер и ввёдем логин и пароль.
Исправление ошибок
После входа снизу может быть ошибка "Хранилище конфигурации phpMyAdmin не полностью настроено, некоторые расширенные функции были отключены". Для ёё исправления нужно нажать на "Узнайте причину" и в открывшемся окне нужно нажать "Создать" в строке "Создать базу данных с именем phpmyadmin"
Если мы попробуем перейти в какую-то из таблиц, то увидим ошибку "Warning in ./libraries/sql.lib.php count(): Parametr must be an array or an object that implements Countable". Для её исправления необходимо отредактировать файл sql.lib.php. Для этого в терминале введём следующую команду:
sudo nano /usr/share/phpmyadmin/libraries/sql.lib.php
В открывшемся файле при помощи комбинации клавиш Ctrl+W необходимо найти строчку $analyzed_sql_results[‘select_expr’] == 1. В данную строчку нужно внести следующие изменения:
Заменить (count($analyzed_sql_results[‘select_expr’] == 1) на ((count($analyzed_sql_results[‘select_expr’]) == 1
Сохраняем при помощи комбинации Crl+O и закрываем Ctrl+X. После перезагрузки страницы данная ошибка должна пропасть.
Так же ошибка может появиться при переходе на вкладку Экспорт. "Warning in ./libraries/plugin_interface.lib.php count(): Parametr must be an array or an object that implements Countable".
Снова открываем файл на редактирование следующей командой:
sudo nano /usr/share/phpmyadmin/libraries/plugin_interface.lib.php
Находим и редактируем следующую строчку:
Заменить ($options != null && count($options) > 0) на ($options != null && count((array)$options) > 0)
Сохраним файл и перезагрузим страницу в браузере, как мы видим ошибка исчезла.
Если вам понравилась статья, то поделитесь ею в социальных сетях: