From: vadimx at gmail dot com Operating system: Windows/Linux PHP version: 5.3.18 Package: SimpleXML related Bug Type: Bug Bug description:Cloning are incorrect
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 bug report at https://bugs.php.net/bug.php?id=63575&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=63575&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=63575&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=63575&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=63575&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=63575&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=63575&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=63575&r=needscript Try newer version: https://bugs.php.net/fix.php?id=63575&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=63575&r=support Expected behavior: https://bugs.php.net/fix.php?id=63575&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=63575&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=63575&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=63575&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63575&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=63575&r=dst IIS Stability: https://bugs.php.net/fix.php?id=63575&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=63575&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=63575&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=63575&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=63575&r=mysqlcfg