|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-05-09 23:53 UTC] amt@php.net
[2004-05-09 23:58 UTC] cwood at austin dot rr dot com
[2004-05-18 08:50 UTC] becharakordahi at hotmail dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 17:00:01 2025 UTC |
Description: ------------ When trying to load a string containing an HTML-encoded non-breaking space (" ") with simplexml_load_string, I get the following warning: Warning: Entity: line 14: error: Entity 'nbsp' not defined in /Library/WebServer/Documents/simple.php on line 11 But other HTML-escaped characters like > and < make it through fine. Reproduce code: --------------- <?php $xmlstr = <<<XML <?xml version='1.0'?> <rss> <channel> <item> <title>This is the title</title> <link>http://globelogger.com</link> <description>This is the description</description> </item> </channel> </rss> XML; $xml = simplexml_load_string(utf8_encode($xmlstr)); foreach($xml->channel->item as $item) { echo "<b><a href=".$item->link.">".$item->title."</a></b><br>".$item->description."<p>"; } ?> Expected result: ---------------- <b><a href=http://globelogger.com>This is the title</ a></b><br>This is the description<p> Actual result: -------------- Warning: Entity: line 7: error: Entity 'nbsp' not defined in /Library/WebServer/Documents/test.php on line 15 Warning: This?is the description in /Library/ WebServer/Documents/test.php on line 15 Warning: ^ in /Library/ WebServer/Documents/test.php on line 15 Warning: Invalid argument supplied for foreach() in / Library/WebServer/Documents/test.php on line 16