#35052 [Opn->Bgs]: $var->$arrayname['item'] fails

From: Date: Tue, 01 Nov 2005 17:54:26 +0000
Subject: #35052 [Opn->Bgs]: $var->$arrayname['item'] fails
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-87357@lists.php.net to get a copy of this message
ID: 35052 Updated by: tony2001@php.net Reported By: sam at liddicott dot com -Status: Open +Status: Bogus Bug Type: Scripting Engine problem Operating System: Linux PHP Version: 4.4.0 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 $this->var is the right syntax for that. Previous Comments: ------------------------------------------------------------------------ [2005-11-01 15:46:33] sam at liddicott dot com Description: ------------ Indirect object array access $var->$arrayname['item'] only takes the first letter of the array name Reproduce code: --------------- <?php # THIS FAILS $name="list"; $obj->$name['item']='test'; var_dump($obj); ?> <?php # THIS WORKS FINE $name="list"; $array=&$obj->$name; $array['item']='test'; var_dump($obj); ?> Expected result: ---------------- object(stdClass)(1) { ["list"]=> string(4) "test" } Actual result: -------------- object(stdClass)(1) { ["l"]=> string(4) "test" } ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=35052&edit=1

« previous php.bugs (#87357) next »