From: tretoria at data dot bg Operating system: win32 PHP version: 5.3.19 Package: Compile Failure Bug Type: Feature/Change Request Bug description:function returning array and directly calling array element parse error
Description: ------------ When calling function which returns array and try to get element of the returned array directly, without copying the result into variable like "foo()[x]" where x is integer, it returns parse syntax error. However this is working in 5.4.* versions. Test script: --------------- <?php function returnArray() { $arr = array("first", "second", "third"); return $arr; } echo returnArray()[1]; ?> Expected result: ---------------- second Actual result: -------------- Parse error: syntax error, unexpected '[', expecting ',' or ';' -- Edit bug report at https://bugs.php.net/bug.php?id=63712&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=63712&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=63712&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=63712&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=63712&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=63712&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=63712&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=63712&r=needscript Try newer version: https://bugs.php.net/fix.php?id=63712&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=63712&r=support Expected behavior: https://bugs.php.net/fix.php?id=63712&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=63712&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=63712&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=63712&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63712&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=63712&r=dst IIS Stability: https://bugs.php.net/fix.php?id=63712&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=63712&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=63712&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=63712&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=63712&r=mysqlcfg