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
