fullfatdesigns

Well-Known Member
Aug 1, 2014
72
11
8
cPanel Access Level
Root Administrator
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
 

mcgee

Registered
Jan 22, 2014
4
0
1
cPanel Access Level
Root Administrator
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.
 

fullfatdesigns

Well-Known Member
Aug 1, 2014
72
11
8
cPanel Access Level
Root Administrator
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