#34563 [Opn->Bgs]: use of indexer on function return value
| From: | tony2001@php.net | Date: | Tue, 20 Sep 2005 12:28:17 +0000 |
| Subject: | #34563 [Opn->Bgs]: use of indexer on function return value | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-85280@lists.php.net to get a copy of this message | ||
ID: 34563
Updated by: tony2001@php.net
Reported By: colin at breame dot net
-Status: Open
+Status: Bogus
-Bug Type: Compile Failure
+Bug Type: Scripting Engine problem
PHP Version: 5.0.5
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Previous Comments:
------------------------------------------------------------------------
[2005-09-20 14:20:15] colin at breame dot net
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 this bug report at http://bugs.php.net/?id=34563&edit=1