Bug #55132 [Opn->Bgs]: String access to an expression gives parse error
| From: | felipe@php.net | Date: | Mon, 04 Jul 2011 23:01:44 +0000 |
| Subject: | Bug #55132 [Opn->Bgs]: String access to an expression gives parse error | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-161584@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=55132&edit=1
ID: 55132
Updated by: felipe@php.net
Reported by: andre at webkr dot de
Summary: String access to an expression gives parse error
-Status: Open
+Status: Bogus
Type: Bug
Package: Scripting Engine problem
Operating System: Windows 7
PHP Version: 5.3.6
Block user comment: N
Private report: N
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
The syntax (...){..} is not intended to work.
Previous Comments:
------------------------------------------------------------------------
[2011-07-04 18:53:24] andre at webkr dot de
Description:
------------
As documented, "accessing variables of other types [...] using [] or {} silently returns
NULL". Because of this it is necessary to cast an integer to string before string access can be
done. However, this results in a parse error.
Test script:
---------------
$i = 123;
echo $i{1}; // -> empty (expected)
echo ((string)$i){1}; // -> parse error
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=55132&edit=1