Bug #63575 [Asn->Opn]: Cloning are incorrect
| From: | kalle@php.net | Date: | Tue, 24 Oct 2017 07:02:42 +0000 |
| Subject: | Bug #63575 [Asn->Opn]: Cloning are incorrect | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-212037@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=63575&edit=1
ID: 63575
Updated by: kalle@php.net
Reported by: vadimx at gmail dot com
Summary: Cloning are incorrect
-Status: Assigned
+Status: Open
Type: Bug
Package: SimpleXML related
Operating System: Windows/Linux
PHP Version: 5.3.18
-Assigned To: helly
+Assigned To:
Block user comment: N
Private report: N
Previous Comments:
------------------------------------------------------------------------
[2012-11-24 15:55:57] laruence@php.net
helly, do you have time to look at this?
------------------------------------------------------------------------
[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