From: valerio dot giuffrida88 at gmail dot com Operating system: ubuntu PHP version: 5.2SVN-2009-10-07 (snap) PHP Bug Type: Compile Failure Bug description: cannot use [...] after a function returning array
Description: ------------ If i want to get an element of an array directly returned by a function, using [], it will prints Parse error: syntax error, unexpected '[', expecting ',' or ';' in php shell code on line 1 Reproduce code: --------------- $a = array("a","b","c"); echo array_values($a)[0]; //it (doesnt) works with any function that retuns an array Expected result: ---------------- print to screen something like that: a Actual result: -------------- Parse error: syntax error, unexpected '[', expecting ',' or ';' in php shell code on line 1 -- Edit bug report at http://bugs.php.net/?id=49804&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=49804&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=49804&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=49804&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=49804&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=49804&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=49804&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=49804&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=49804&r=needscript Try newer version: http://bugs.php.net/fix.php?id=49804&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=49804&r=support Expected behavior: http://bugs.php.net/fix.php?id=49804&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=49804&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=49804&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=49804&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49804&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=49804&r=dst IIS Stability: http://bugs.php.net/fix.php?id=49804&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=49804&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=49804&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=49804&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=49804&r=mysqlcfg