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

Permalink 1 user found helpful
Hi,

I had to switch my concrete5 installation from one server to a new one.
The old installation is c5 8.2.1 running fine with php 7.1

The issue is that the new server has already php 7.3 installed. Unfortunately there is no way back to 7.2/7.1

After moving the c5 installation it didn't start up. So I upgraded the moved installation to 8.5.1 using the method "Replacing the original concrete Directory (Version 8 and above)" found at "https://documentation.concrete5.org/developers/installation/upgrading-concrete5"

Now c5 starts up but claims an error: "count(): Parameter must be an array or an object that implements Countable" wit the file "packages/theme_stucco/blocks/autonav/templates/stucco_global_nav_animenu/view.php"

Any ideas what I can do to solve this issue or to work around?

Regards
Michael

1 Attachment

 
mnakalay replied on at Permalink Best Answer Reply
mnakalay
Hello,
PHP 7.2 and above is much less accepting of errors.

In the file you are referencing, on line 56 you have
$iniCountSub = count($navItems->hasSubmenu);

count() only accepts countable objects but $navItems->hasSubmenu is not. It is a boolean so its only possible values are TRUE or FALSE.

You should be able to fix this problem by replacing that line with
$iniCountSub = $navItems->hasSubmenu;

But if the Stucco theme is not updated for your version of PHP you might end up with other errors one after the other.

You should probably contact the theme's developer and let them know so they can upgrade their theme.

So to be clear the problem is is not Concrete5 it is the Stucco theme
grote replied on at Permalink Reply
Hi,

I solved the problem by downloading a fresh copy of the theme

Thanks for the helpfull advice

KR Michael