ID: 14152 Updated by: edink Reported By: [EMAIL PROTECTED] Status: Open Bug Type: Class/Object related Operating System: Linux 2.2.16-enterprise PHP Version: 4.0.5 New Comment:
Much easier to reproduce by: $a->$b="c"; Foreach loop should of course read foreach($myarray as $key=>$value) Previous Comments: ------------------------------------------------------------------------ [2001-11-20 13:22:53] [EMAIL PROTECTED] Using the following code (which someone may do accidentally): $myarray = array("X" => "A", "Y" => "B", "Z" => "C"); foreach($myarray as $key->$value) { ... } causes PHP (on each iteration) to create an object $key with the value of the current array element in a property with a blank name (because $value has just been created, and is therefore empty). The following var_dump() output illustrates: object(stdClass)(1) { [""]=> string(1) "A" } The creation of objects with blank property names seems like it shouldn't be possible (even unintentionally)! ------------------------------------------------------------------------ Edit this bug report at http://bugs.php.net/?id=14152&edit=1 -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]