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

24.12.2021 07:28
#1
sglodek
Joomshopping forum user no avatar
Name: Siegbert Glodek
31.03.2012
Posts: 11
Quote
PHP Warning: count(): Parameter must be an array or an object that implements Countable

Hallo zusammen,

im Error Log meines Servers habe ich hunderte von Einträgen mit diesem Text:

PHP Warning: count(): Parameter must be an array or an object that implements Countable in ... /components/com_jshopping/templates/defaultg/product/product_default.php on line 126

Zeile 126 im Template ist diese:
<?php if (count($this->product->freeattributes)){?>

Es scheint also mit "freeattributes" zusammenzuhängen. Die Meldung tritt aber unabhängig davon auf, ob ich in einem Produkt Attribute vergeben habe oder nicht.
Auch wenn es nur eine Warning ist, würde ich das gerne beheben, da diese Meldung mehr als 90% der Einträge im Error.log ausmacht.

Muss ich in meiner Konfiguration der Produkte etwas anpassen oder im Code des Templates?

Daken für hifreiche Tipps,
Siegbert


Joomla: 3.10.4
JoomShopping: 4.18.7
PHP: 7.4.16
MySQL: 5.7.33
Website Url: glodek-edv.de
 
24.12.2021 07:45
#2
admin
(Support Team)
User admin
Name: Admin
05.08.2010
Posts: 25919
Quote
Aw: PHP Warning: count(): Parameter must be an array or an object that implements Countable

Change
<?php if (count($this->product->freeattributes)){?>

to

<?php if (isset($this->product->freeattributes) && count($this->product->freeattributes)){?>


Last change: 24.12.2021 07:46
 


Copyrights MAXXmarketing GmbH. Alle Rechte vorbehalten
Durch die Nutzung dieser Website stimme ich zu, dass Cookies zur optimalen Gestaltung der Website sowie zur Analyse der Nutzung der Website verwendet werden. Weiterführende Informationen finden Sie hier. OK, einverstanden.