normal Fatal error: Cannot use object of type stdClass as array

More
8 years 10 months ago #8147 by Vicky Bower
Fatal error: Cannot use object of type stdClass as array in /home/mysite/public_html/modules/mod_otclientlogosscroller/elements/otclientlogosscroller.php on line 73

Module installs fine - I edit the module but on saving I get this in backend which prevents me from editing the slider so I am forced to uninstall and reinstall the module if I need to do any edits!

Please Log in or Create an account to join the conversation.

More
8 years 6 months ago #8339 by Igor Maric
I've got the same problem and this is the first time I downloaded the module. Everything went well but this. When saved it displays this message, but only this time it's line 73.

Please Log in or Create an account to join the conversation.

More
8 years 5 months ago #8386 by Tanase Butcaru
Hello guys,

Just got into this bug when using FaLang to translate the module.
The error is right, the " $this->value[$i] " is an object, not an array AND it is used as an array.

As a quick fix:
- open
Code:
modules/mod_otclientlogosscroller/elements/otclientlogosscroller.php
- go to line 72 (where the for loop starts) and add the following:
Code:
$this->value[$i] = (array) $this->value[$i];

So, old code:
Code:
71 if (!empty($this->value)){ 72 for ($i = 0; $i < count($this->value); $i++){ 73 if (!empty($this->value[$i]['avatar']))
...and the code with the fix:
Code:
71 if (!empty($this->value)){ 72 for ($i = 0; $i < count($this->value); $i++){ 73 $this->value[$i] = (array) $this->value[$i]; 74 if (!empty($this->value[$i]['avatar']))

Please Log in or Create an account to join the conversation.

Time to create page: 0.235 seconds

About Growth

Innovative tech for eCommerce growth

Contact Info

Head: No. 3, 175/55 Lane, Lac Long Quan St., Nghia Do Ward, Cau Giay District, Hanoi City, Vietnam