fixing "count(): Parameter must be an array or an object that implements ..."

Started by aegersz, May 16, 2021, 11:16:42 AM

Previous topic - Next topic

aegersz

I have tried and failed to fix this bug; this came in at php 7.2 and the full error is:

count(): Parameter must be an array or an object that implements Countable

the offending line of code is:
return count(isset($context['friends']) ? $context['friends'] : null);

any suggestions ?
The configuration of my Linux VPS (SMF 2.0 with 160+ mods & some assorted manual tweaks) can be found here and notes on my mods can be found here (warning: those links will take you to a drug related forum). My (House) music DJ dedication page is here

d3vcho

"Greeting Death as an old friend, they departed this life as equals"

shawnb61

A question worth asking is born in experience & driven by necessity. - Fripp

aegersz

The configuration of my Linux VPS (SMF 2.0 with 160+ mods & some assorted manual tweaks) can be found here and notes on my mods can be found here (warning: those links will take you to a drug related forum). My (House) music DJ dedication page is here

aegersz

Quote from: shawnb61 on May 16, 2021, 11:35:30 AM
Try replacing 'null' with 'array()'.

I think that worked ... many, many thanks if it stays that way !
The configuration of my Linux VPS (SMF 2.0 with 160+ mods & some assorted manual tweaks) can be found here and notes on my mods can be found here (warning: those links will take you to a drug related forum). My (House) music DJ dedication page is here

Advertisement: