Ask a Question related to PHP Bugs, Design and Development.
-
saschagros at bluewin dot ch #1
#39760 [NEW]: cloning fails on nested SimpleXML-Object
From: saschagros at bluewin dot ch
Operating system: Windows/Linux
PHP version: 5.2.0
PHP Bug Type: SimpleXML related
Bug description: cloning fails on nested SimpleXML-Object
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 bug report at [url]http://bugs.php.net/?id=39760&edit=1[/url]
--
Try a CVS snapshot (PHP 4.4): [url]http://bugs.php.net/fix.php?id=39760&r=trysnapshot44[/url]
Try a CVS snapshot (PHP 5.2): [url]http://bugs.php.net/fix.php?id=39760&r=trysnapshot52[/url]
Try a CVS snapshot (PHP 6.0): [url]http://bugs.php.net/fix.php?id=39760&r=trysnapshot60[/url]
Fixed in CVS: [url]http://bugs.php.net/fix.php?id=39760&r=fixedcvs[/url]
Fixed in release: [url]http://bugs.php.net/fix.php?id=39760&r=alreadyfixed[/url]
Need backtrace: [url]http://bugs.php.net/fix.php?id=39760&r=needtrace[/url]
Need Reproduce Script: [url]http://bugs.php.net/fix.php?id=39760&r=needscript[/url]
Try newer version: [url]http://bugs.php.net/fix.php?id=39760&r=oldversion[/url]
Not developer issue: [url]http://bugs.php.net/fix.php?id=39760&r=support[/url]
Expected behavior: [url]http://bugs.php.net/fix.php?id=39760&r=notwrong[/url]
Not enough info: [url]http://bugs.php.net/fix.php?id=39760&r=notenoughinfo[/url]
Submitted twice: [url]http://bugs.php.net/fix.php?id=39760&r=submittedtwice[/url]
register_globals: [url]http://bugs.php.net/fix.php?id=39760&r=globals[/url]
PHP 3 support discontinued: [url]http://bugs.php.net/fix.php?id=39760&r=php3[/url]
Daylight Savings: [url]http://bugs.php.net/fix.php?id=39760&r=dst[/url]
IIS Stability: [url]http://bugs.php.net/fix.php?id=39760&r=isapi[/url]
Install GNU Sed: [url]http://bugs.php.net/fix.php?id=39760&r=gnused[/url]
Floating point limitations: [url]http://bugs.php.net/fix.php?id=39760&r=float[/url]
No Zend Extensions: [url]http://bugs.php.net/fix.php?id=39760&r=nozend[/url]
MySQL Configuration Error: [url]http://bugs.php.net/fix.php?id=39760&r=mysqlcfg[/url]
saschagros at bluewin dot ch Guest
-
#38406 [Asn->Csd]: PHP crashes when manipulating with SimpleXML object
ID: 38406 Updated by: tony2001@php.net Reported By: zizka at seznam dot cz -Status: Assigned +Status: ... -
#38406 [NoF->Asn]: PHP crashes when manipulating with SimpleXML object
ID: 38406 Updated by: tony2001@php.net Reported By: zizka at seznam dot cz -Status: No Feedback +Status: ... -
#39760 [Opn->Asn]: cloning fails on nested SimpleXML-Object
ID: 39760 Updated by: tony2001@php.net Reported By: saschagros at bluewin dot ch -Status: Open +Status: ... -
#24957 [NEW]: simplexml: var_dump of object segfaults
From: tater at potatoe dot com Operating system: OS X 10.2 PHP version: 5CVS-2003-08-05 (dev) PHP Bug Type: XML related Bug... -
[PHP-DEV] Object cloning
If I understand correctly the idea is that you will be able to call=20 zend_objects_clone_members() from your clone implementation? If so, I think=... -
rrichards@php.net #2
#39760 [Asn->Csd]: cloning fails on nested SimpleXML-Object
ID: 39760
Updated by: [email]rrichards@php.net[/email]
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
[url]http://snaps.php.net/[/url].
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 [url]http://bugs.php.net/?id=39760&edit=1[/url]
rrichards@php.net Guest



Reply With Quote

