php7.2 Suppress warnings in cms admin
Hi
I've recently upgraded php on our server to 7.2. There are some CMS sites that are displaying warnings in the admin backend of the sites (front-end is OK). Warnings like;
: count(): Parameter must be an array or an object that implements Countable in on line
Rather than downgrading the php level to 7.1, is there a way to suppress/hide these warnings?
Thanks
Wayne
-
Yes check is_array function or is_object function in a if statement before the count will fix this issue or user error_reporting(0); So $a = 0; if(is_array($array) || is_object($array)) { $a = count($array); } this code will fix that. 0 -
Hi Mcgee Thanks for the suggestion. I was hoping there was a way to switch off the warnings as the count example warning was just one of the warnings and there are several sites, so I guess I was hoping for an easy option ;) If there isn't though, I'll look at trying this though, thanks. Wayne 0 -
Thanks Infopro I've had a quick skim and it seems like there are a few ways of achieving what I'm after. I'll have a proper read and go over the weekend. 0
Please sign in to leave a comment.
Comments
4 comments