#34563 [NEW]: use of indexer on function return value

From: Date: Tue, 20 Sep 2005 12:20:15 +0000
Subject: #34563 [NEW]: use of indexer on function return value
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-85279@lists.php.net to get a copy of this message
From: colin at breame dot net Operating system: PHP version: 5.0.5 PHP Bug Type: Compile Failure Bug description: use of indexer on function return value Description: ------------ When using an indexer on a return value of a function, the compiler returns an error: parse error, unexpected '[' I would expect it to compile as it would be a valid expression. Reproduce code: --------------- Does not compile: <?php print test()['test']; function test() { return array('test'=>1); } ?> Does compile: <?php $tmp = test(); print $tmp['test']; function test() { return array('test'=>1); } ?> Expected result: ---------------- Actual result: -------------- PHP Parse error: parse error, unexpected '[' in test.php on line 2 -- Edit bug report at http://bugs.php.net/?id=34563&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=34563&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=34563&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=34563&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=34563&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=34563&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=34563&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=34563&r=needscript Try newer version: http://bugs.php.net/fix.php?id=34563&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=34563&r=support Expected behavior: http://bugs.php.net/fix.php?id=34563&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=34563&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=34563&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=34563&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=34563&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=34563&r=dst IIS Stability: http://bugs.php.net/fix.php?id=34563&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=34563&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=34563&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=34563&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=34563&r=mysqlcfg

« previous php.bugs (#85279) next »