This topic was marked solved by Nao, on March 27th, 2014, 10:53 PM
Fatal error: Unsupported operand types (Load.php on line 1971)

Adam Dresch

  • Posts: 4
Hello there!

Just testing our Wedge and on a fresh installation, I get:

Fatal error: Unsupported operand types in /home/theguard/public_html/wedge/gz/app/Load.php on line 1971

As can be seen here - http://theguardians.us/wedge/

Line 1971 is -

$language_directories += glob(LANGUAGES_DIR . '/*', GLOB_ONLYDIR);

Section of code being:

   // Default language directories to try.
   $language_directories = array(
      'root' => LANGUAGES_DIR,
   );
   $language_directories += glob(LANGUAGES_DIR . '/*', GLOB_ONLYDIR);

Nao

  • Dadman with a boy
  • Posts: 16,082

Adam Dresch

  • Posts: 4
Re: Fatal error: Unsupported operand types (Load.php on line 1971)
« Reply #2, on March 3rd, 2014, 06:33 PM »
Hi Nao

I'm wondering if it's because I have Litespeed? would that affect it?

PHP Version 5.3.28
LiteSpeed V6.6
with XCache v3.1.0, Copyright (c) 2005-2013, by mOo
with the ionCube PHP Loader v4.4.1, Copyright (c) 2002-2013, by ionCube Ltd.
with XCache Cacher v3.1.0, Copyright (c) 2005-2013, by mOo
MySQL 5.5.36

Nao

  • Dadman with a boy
  • Posts: 16,082

Adam Dresch

  • Posts: 4

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: Fatal error: Unsupported operand types (Load.php on line 1971)
« Reply #6, on March 3rd, 2014, 07:09 PM »
Oh my...
Still, that's no solution. Other people are using LiteSpeed, and I need to make sure that this line of code will be accepted, or rewrite it in an acceptable way. (Its only purpose is to add to an array a list of language sub-folders that should be searched for language items. There are approximately 8742 different ways of doing that, but this one was by far the shortest and coolest. I tend to commit my code only when it's short and cool enough. Cool because I'm vain, and short because it makes for more maintainable code if it's not too cryptic.)
Posted: March 3rd, 2014, 07:02 PM

Stupid me!! That's what happens when you're trying to work on several things at the same time.

I just realized that the error wasn't due to glob() (I focused too much on GLOB_ONLYDIR), but on the "+=" item.
Thing is, glob() MAY return false instead of an array, if an error occurred.
I don't know why your error wasn't logged, though...! Who cares that the operand is unsupported. What I want to know is why your code failed in the first place.

Can you re-enable LiteSpeed, and replace the line of code with this?

Code: [Select]
$language_directories += (array) glob(LANGUAGES_DIR . '/*', GLOB_ONLYDIR);

This will force typecasting the result to an array, and avoid this error. Then, maybe it'll finally record the error...

txcas

  • Bug Zapper
  • Posts: 202

Nao

  • Dadman with a boy
  • Posts: 16,082

CvH

  • Posts: 6

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: Fatal error: Unsupported operand types (Load.php on line 1971)
« Reply #11, on March 27th, 2014, 05:15 PM »
Also, from now on, I'll reserve my right to give free support to anyone who doesn't provide a link to their website (either the Wedge version, or a previous version not running Wedge.)

Just saying. I'm not getting paid here, and apart from the forum regulars, people come, ask for support, get it, and then rarely even bother to say thanks to anyone who helped...

CvH

  • Posts: 6
Re: Fatal error: Unsupported operand types (Load.php on line 1971)
« Reply #12, on March 27th, 2014, 05:34 PM »Last edited on March 27th, 2014, 05:41 PM
Code: [Select]
// $language_directories += glob(LANGUAGES_DIR . '/*', GLOB_ONLYDIR);
$language_directories += (array) glob(LANGUAGES_DIR . '/*', GLOB_ONLYDIR);

fixed it for me ! thanks for quick help

(it is a local test install of wedge, so no url or something because it only shows a blank white page ;) )

Nao

  • Dadman with a boy
  • Posts: 16,082