|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-11-01 18:54 UTC] tony2001@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Dec 04 22:00:01 2025 UTC |
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" }