ID:               44741
 Updated by:       [EMAIL PROTECTED]
 Reported By:      php at benjaminschulz dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         DOM XML related
 Operating System: linux, osx, windows
 PHP Version:      5.3CVS-2008-04-16 (CVS)
 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

In XML, no matter what parser you use, carriage returns are removed or

replaced with a line feed in documents before processing them. You must

use character entities to preserve a carriage return.


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

[2008-04-16 12:01:48] php at benjaminschulz dot com

this is reproducable on linux, osx and windows

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

[2008-04-16 10:41:07] php at benjaminschulz dot com

Description:
------------
If you load a xml document that contains \r they are silently replaced
by \n, even in CDATAs.
No matter to what ignoreWhiteSpace is set.

Reproduce code:
---------------
<?php
$doc = new DomDocument;
$xml = "<?xml version=\"1.0\"?><foo>\r \r\n <![CDATA[\r]]></foo>";
$doc->loadXml($xml);
var_dump(substr_count($doc->saveXml(), "\r"));
var_dump(substr_count($doc->saveXml(), "\n"));

Expected result:
----------------
int(3) int(1) 

This is the output of:
var_dump(substr_count($xml, "\r"));
var_dump(substr_count($xml, "\n"));

Actual result:
--------------
int(0) int(5) 


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


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

Reply via email to