Bug #63575 [Opn]: Cloning are incorrect
Edit report at https://bugs.php.net/bug.php?id=63575&edit=1
ID: 63575
Updated by: laruence@php.net
Reported by: vadimx at gmail dot com
Summary: Cloning are incorrect
Status: Open
Type: Bug
Package: SimpleXML related
Operating System: Windows/Linux
PHP Version: 5.3.18
-Assigned To:
+Assigned To: helly
Block user comment: N
Private report: N
New Comment:
helly, do you have time to look at this?
Previous Comments:
------------------------------------------------------------------------
[2012-11-21 17:52:57] vadimx at gmail dot com
Description:
------------
When changing child's in cloned object, it's change in parent object, not in
cloned.
Test script:
---------------
$xml = '<a><b></b></a>';
$o1 = new SimpleXMlElement($xml);
$o2 = clone $o1;
$r = current($o2->xpath('/a'));
$r->addChild('c',new SimpleXMlElement('<c></c>'));
echo $o1->asXML();
echo PHP_EOL;
echo $o2->asXML();
Expected result:
----------------
<?xml version="1.0"?>
<a><b/></a>
<a><b/><c></c></a>
Actual result:
--------------
<?xml version="1.0"?>
<a><b/><c></c></a>
<a><b/></a>
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=63575&edit=1
Thread (6 messages)