php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41792 simplexml newlines in attributes
Submitted: 2007-06-24 19:39 UTC Modified: 2007-06-25 11:39 UTC
From: alexander dot krause at erazor-zone dot de Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.2.3 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: alexander dot krause at erazor-zone dot de
New email:
PHP Version: OS:

 

 [2007-06-24 19:39 UTC] alexander dot krause at erazor-zone dot de
Description:
------------
newlines in attributes are allowed (htmlentities also does not 
convert newlines to 
 ) but they'll be removed when using 
simplexml.

Reproduce code:
---------------
$xml = new SimpleXMLElement(
'<?xml version="1.0" encoding="UTF-8" standalone="yes"?><str val="Line 1
Line2
Line3"/>'
);

echo $xml->asXML(); 


Expected result:
----------------
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<str val="Line 1
Line2
Line3"/>


Actual result:
--------------
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<str val="Line 1 Line2 Line3"/>

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-06-25 11:39 UTC] rrichards@php.net
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

The newlines in the attribute values are being normalized:
http://www.w3.org/TR/REC-xml/#AVNormalize
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Mon Aug 31 03:00:02 2026 UTC