count(): Parameter must be an array or an object
This tutorial is for count(): Parameter must be an array or an object. The error: Warning in ./libraries/sql.lib.php#614 count(): Parameter must be an array or an object that implements Countable. As of PHP 7.2 count() will now issue a warning if the variable passed is not an array or countable object. actually this error comes from a PHPMyAdmin library. The library name is /usr/share/phpmyadmin/libraries/sql.lib.php line no 614.
Error: Warning in ./libraries/sql.lib.php#614 count(): Parameter must be an array or an object that implements Countable.
sql.lib.php
Now open sql.lib.php in nano or vi commnad.
$ sudo vi /usr/share/phpmyadmin/libraries/sql.lib.php
#/usr/share/phpmyadmin/libraries/sql.lib.php #old_code ((count($analyzed_sql_results['select_expr'] == 1) #new_code ((count($analyzed_sql_results['select_expr']) == 1)
Full code
#/usr/share/phpmyadmin/libraries/sql.lib.php
#old_code
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;
}
#/usr/share/phpmyadmin/libraries/sql.lib.php
#new_code
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;
}
Restart the server apache:
$ sudo service apache2 restart