#37386 [Opn->Asn]: autocreating element doesn't assign value to first node

From: Date: Wed, 24 May 2006 21:35:48 +0000
Subject: #37386 [Opn->Asn]: autocreating element doesn't assign value to first node
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-97549@lists.php.net to get a copy of this message
 ID:               37386
 Updated by:       tony2001@php.net
 Reported By:      m dot kurzyna at crystalpoint dot pl
-Status:           Open
+Status:           Assigned
 Bug Type:         SimpleXML related
 Operating System: Linux
 PHP Version:      5.1.4
-Assigned To:      
+Assigned To:      helly


Previous Comments:
------------------------------------------------------------------------

[2006-05-09 19:44:45] m dot kurzyna at crystalpoint dot pl

Description:
------------
If autocreating new nodes by id ($obj->node[0] = '') 
SimpleXML doesn't assign value to first node. Creating 
first node w/o using id works fine.

Reproduce code:
---------------
<?php

  $sx1 = new SimpleXMLElement("<root />");

  $sx1->node[0] = 'node1';
  $sx1->node[1] = 'node2';

?>

Expected result:
----------------
object(SimpleXMLElement)[1]
  public 'node' => 
    array
      0 => 'node1' (length=5)
      1 => 'node2' (length=5)

Actual result:
--------------
object(SimpleXMLElement)[1]
  public 'node' => 
    array
      0 => 
        object(SimpleXMLElement)[6]
      1 => 'node2' (length=5)


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=37386&edit=1


Thread (4 messages)

« previous php.bugs (#97549) next »