Forum

Thread tagged as: Error, Shop

Shop perch_shop_cart() generates: Parameter must be an array or an object that i...

In Perch (non-runway) 3.1.2 on PHP 7.2.4 I'm getting the following warning when calling the shop function perch_shop_cart(); :

Warning: count(): Parameter must be an array or an object that implements Countable in /Users/mwesten/Sites/pls.test/beheer/addons/apps/perch_shop/lib/PerchShop_Cart.class.php on line 516

Changing line 516 in PerchShop_Cart.class.php from:

        if (count($json)) {

to

        if (PerchUtil::count($json)) {

Seems to fix it...?

Max Westen

Max Westen 0 points

  • 2 years ago

Hmmm I think the idea there was to check if there exist cart properties that get returned in a json string. Counting it doesn't work on a string, so maybe better try to see if the string is not empty?

if (!empty($json)) {