count(): Parameter must be an array or an object that implements Countable error after upgrading to PHP7.3

Permalink
Hi all. For those who may come across this error after upgrading a site to PHP7.3
"count(): Parameter must be an array or an object that implements Countable"

I'm sure there are other causes but make sure in your page_theme.php file that the "getThemeResponsiveImageMap()" function is completely commented out if you are not using it and not just the options. This was how it was in a couple of my sites and caused no issue until upgrading PHP.
public function getThemeResponsiveImageMap()
    {
        /*return array(
            'large' => '900px',
            'medium' => '768px',
            'small' => '0'
        );*/
    }


Hopefully this helps those who's dev skills are like mine... just enough to be dangerous.
Cheers,
Chris

 
ConcreteOwl replied on at Permalink Reply
ConcreteOwl
If you post the full error message we may be able to offer a better solution.
Chrouglas replied on at Permalink Reply
Thanks ConcreteOwl but there is no error anymore. I posted this more as cautionary tale in case some other person starts off with a premade theme and makes the mistake of only commenting out the values within the function mentioned above just like I did. And then spends an entire day googling the error and banging their head on their desk... again just like I did.

I do appreciate the reply though.