|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2011-07-25 06:27 UTC] pajoye@php.net
-Status: Open
+Status: Assigned
-Assigned To:
+Assigned To: rrichards
[2011-07-25 06:27 UTC] pajoye@php.net
[2012-09-20 06:51 UTC] rrichards@php.net
[2012-09-20 06:51 UTC] rrichards@php.net
-Status: Assigned
+Status: Not a bug
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 17:00:01 2025 UTC |
Description: ------------ SimpleXML seems to ignore/remove line breaks (\n) in the attributes. Line breaks inside an attribute are valid XML, but they're lost when you use SimpleXML to read the XML data. I encountered this problem when reading XML data provided by the Google Webmaster Tools API Test script: --------------- XML: <?xml version="1.0"?> <feed><entry description="this is the first line here's a second line and another!" /></feed> PHP: $xml = simplexml_load_string($xmldata); foreach ($xml->entry as $entry) { $attributes = $entry->attributes(); print_r($attributes); } Expected result: ---------------- Keep the line breaks from the attribute values after reading the string. $attributes['description'] == "this is the first line here's a second line and another!"; Actual result: -------------- The string no longer contains line breaks: $attributes['description'] == "this is the first line here's a second line and another!";