#46672 [Com]: Cloned SimpleXML Output Different

From: Date: Mon, 01 Dec 2008 17:25:54 +0000
Subject: #46672 [Com]: Cloned SimpleXML Output Different
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-131522@lists.php.net to get a copy of this message
 ID:               46672
 Comment by:       rfludwick at gmail dot com
 Reported By:      rfludwick at gmail dot com
 Status:           Feedback
 Bug Type:         SimpleXML related
 Operating System: Gentoo Linux
 PHP Version:      5.2.6
 New Comment:

Still broken in that snapshot.


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

[2008-11-27 02:01:56] jani@php.net

Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/



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

[2008-11-25 23:35:36] rfludwick at gmail dot com

Description:
------------
It appears that cloning a SimpleXML object will not produce the same
XML output on asXML() as the original object. The original will output
the XML header and a line break after the XML while the cloned object is
missing these.

Reproduce code:
---------------
<?php
$simplexml = new SimpleXMLElement("<root />");
$simplexml->path->to->node = "Zend";

$simplexml_2 = clone $simplexml;

echo "|{$simplexml->asXML()}|\n|{$simplexml_2->asXML()}|";

Expected result:
----------------
|<?xml version="1.0"?>
<root><path><to><node>Zend</node></to></path></root>
|
|<?xml version="1.0"?>
<root><path><to><node>Zend</node></to></path></root>
|

Actual result:
--------------
|<?xml version="1.0"?>
<root><path><to><node>Zend</node></to></path></root>
|
|<root><path><to><node>Zend</node></to></path></root>|


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


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



Thread (9 messages)

« previous php.bugs (#131522) next »