Report about an error with the notation of an object (Bugs)

by Auge ⌂ @, Friday, February 17, 2017, 17:43 (101 days ago)


I got an error report via e-mail, that I will cite in extracts here. I can't name the reason because I can't find a doc about this special case.

Begin of the cite from the report.

We were in a process to update my little forum package to 2.4 but manual
installation throws following error :
Parse error: syntax error, unexpected '[' in
/{PATH}/litforum24/includes/functions.inc.php on line 2675

I guess this is due to PHP version. It does not work on 5.2 and 5.3. It
works well on PHP 5.4+

End of the cite. I linked to the code and here it is.

   $release = (object) [   // <== here the error occurs
    'title'   => (string)$title[0],
    'content' => (string)$content[0],
    'version' => (string)$lastVersion,
    'uri'     => $baseURI . (string)$releaseURI[0]->href

I can't confirm or negate the assumption that it has to do with the PHP version. All examples of the (object)-notation, I found on php.net had another syntax with the function array. I have no clue, if it has to do with the error.

$var = (object) array('title' => (string)$title[0],);

On the other hand, the PHP versions 5.2 and 5.3, where the error occurs, are ancient and outdated nowadays. We have always to check the code for the use of functions, that are introduced in PHP in newer versions. I can't believe, that there is no function and/or no syntax, that is newer than PHP 5.2 (and MySQL 4.1).

Tschö, Auge

further development of mlf1

2.4, bug

Complete thread:

 RSS Feed of thread

powered by my little forum