Welcome, Guest
Username: Password: Remember me

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

Fatal error: Cannot use object of type stdClass as array 1 year 5 months ago #8147

  • vickula
  • vickula's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 1
  • Karma: 0
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!
The administrator has disabled public write access.

Fatal error: Cannot use object of type stdClass as array 1 year 1 month ago #8339

  • hetfanatic
  • hetfanatic's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 1
  • Karma: 0
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.
The administrator has disabled public write access.

[FIX] Fatal error: Cannot use object of type stdClass as array 1 year 1 week ago #8386

  • kr3ck3n
  • kr3ck3n's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 1
  • Karma: 0
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
modules/mod_otclientlogosscroller/elements/otclientlogosscroller.php
- go to line 72 (where the for loop starts) and add the following:
$this->value[$i] = (array) $this->value[$i];

So, old 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:
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']))
The administrator has disabled public write access.
Time to create page: 0.161 seconds