Project

General

Profile

PHP Error when trying to use eXtplorer?

Added by Jason M 8 months ago

I just installed eXtplorer and get an error:

Parse error: syntax error, unexpected '[' in /eXtplorer/libraries/standalone.php on line 232

I tried the 2.1.9 and 2.1.10 versions and both are doing this.

Any idea what is going on?

I have PHP 5.3.27 on this server.


Replies (1)

RE: PHP Error when trying to use eXtplorer? - Added by Atesin Dj 6 months ago

i had the same problem... after cracking my head on the screen i found some suggestion on stack exchange that lead me to php.net Array page

php <= 5.3 (as in centos 6) does not support 'array dereferencing' that is calling an element directly from a function that returns an array, something like

$my_array_element = my_function_that_returns_an_array($blah)[$my_desired_index];

you should use instead

$my_temp_array = my_function_that_returns_an_array($blah);
$my_array_element = $my_temp_array[$desired_index];

more info = http://php.net/manual/en/language.types.array.php example #7

specifically, i fixed this by editing some files, i dont know if the issue are replicated somewhere else

libraries/standalone.php on line 232
< $this->_userstate[$var_name] = $iFilter->sanitize( array($this->_userstate[$var_name]) )[0];

$tmp_arr = $iFilter->sanitize( array($this->_userstate[$var_name]) );$this->_userstate[$var_name] = $tmp_arr0;

include/functions.php on line 1192
< $return = $noHtmlFilter->sanitize( array($return) )[0];

$tmp_arr = $noHtmlFilter->sanitize( array($return) );$return = $tmp_arr0;

    (1-1/1)