Fixing that pesky "Parameter must be an array" error in PhPMyAdmin

I don't know who needs to hear this... Oh well, I do, because I forget things that I've done and this here blog is as good a place as any to put something that I might need to look up later.

When your PhPMyAdmin on Ubuntu Bionic Beaver (*giggle*) and PhP 7.2 keeps spitting out dumb errors on every page load, like this;

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

You need to edit the sql.lib.php file, specifically you need to edit line 613.

sudo nano +613 /wherever/phpmyadmin/libraries/sql.lib.php

See this? Second line has a missing ")" after $analyzed_sql_results['select_expr'], and it has one extra after ['select_expr'][0] == '*'))) in the row below.

So change it to this:

((empty($analyzed_sql_results['select_expr']))
    || (count($analyzed_sql_results['select_expr']) == 1)
        && ($analyzed_sql_results['select_expr'][0] == '*'))

And then restart Nginx or whatever. Now you'll not have to see that error again.


Dabitch

Dabitch

Founder of adland®, sweetheart hell-raiser, tired of writing bios.