#44741 [Opn]: dom mangles returns (\r)

From: Date: Wed, 16 Apr 2008 12:01:48 +0000
Subject: #44741 [Opn]: dom mangles returns (\r)
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-124282@lists.php.net to get a copy of this message
ID: 44741 User updated by: php at benjaminschulz dot com Reported By: php at benjaminschulz dot com Status: Open Bug Type: DOM XML related -Operating System: osx +Operating System: linux, osx, windows PHP Version: 5.3CVS-2008-04-16 (CVS) New Comment: this is reproducable on linux, osx and windows Previous Comments: ------------------------------------------------------------------------ [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

« previous php.bugs (#124282) next »