ID:               39760
 Updated by:       [EMAIL PROTECTED]
 Reported By:      saschagros at bluewin dot ch
-Status:           Assigned
+Status:           Closed
 Bug Type:         SimpleXML related
 Operating System: Windows/Linux
 PHP Version:      5.2.0
 Assigned To:      helly
 New Comment:

This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.




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

[2006-12-06 22:20:13] saschagros at bluewin dot ch

Description:
------------
"clone $simpleXML->subElement1->subElement2" does not work as
excepted.

It does not return a clone of itself but a clone of it's parent.

Tested on:
Windows with PHP 5.2.0
Linux with PHP 5.2.0
Linux with PHP 5.0.4

Reproduce code:
---------------
$xml = '<?xml version="1.0" ?>
<test>
    <level1>
        <level2a>text1</level2a>
        <level2b>text2</level2b>
   </level1>
</test>';
$test = simplexml_load_string($xml);

print_r($test->level1->level2a);

$test2 = clone $test;
print_r($test2->level1->level2a);

$test3 = clone $test->level1->level2a;
print_r($test3);

Expected result:
----------------
SimpleXMLElement Object
(
    [0] => text1
)
SimpleXMLElement Object
(
    [0] => text1
)
SimpleXMLElement Object
(
    [0] => text1
)


Actual result:
--------------
SimpleXMLElement Object
(
    [0] => text1
)
SimpleXMLElement Object
(
    [0] => text1
)
SimpleXMLElement Object
(
    [level2a] => text1
    [level2b] => text2
)


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


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

Reply via email to