#42622 [Opn->Bgs]: Cannot use $object->{'prop["key"]}
ID: 42622
Updated by: johannes@php.net
Reported By: adrian dot gheorghe at gmail dot com
-Status: Open
+Status: Bogus
Bug Type: Variables related
Operating System: Windows
PHP Version: 5.2.4
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
You want $bar->{'b'}['c'].
Previous Comments:
------------------------------------------------------------------------
[2007-09-11 10:41:35] adrian dot gheorghe at gmail dot com
Description:
------------
If this is not going to be supported, it should at least be documented.
I couldn't find anything related to this limitation.
Reproduce code:
---------------
<?php
class Foo
{
public $a = 3;
public $b = array( 'c' => 9 );
}
$bar = new Foo;
echo $bar->{'a'}; // works
echo $bar->{'b["c"]'}; // doesn't work
?>
Expected result:
----------------
Output:
3
9
Actual result:
--------------
Output:
3
Notice: Undefined property: Foo::$b["c"] in
C:\www\project.local.ro\trunk\Source\public\test.php on line 11
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=42622&edit=1
Thread (2 messages)