php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28340 simplexml_load_string chokes on " "
Submitted: 2004-05-09 21:29 UTC Modified: 2004-05-09 23:53 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: cwood at austin dot rr dot com Assigned:
Status: Not a bug Package: SimpleXML related
PHP Version: 5.0.0RC2 OS: Mac OS X 10.2.8
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: cwood at austin dot rr dot com
New email:
PHP Version: OS:

 

 [2004-05-09 21:29 UTC] cwood at austin dot rr dot com
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&nbsp;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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-05-09 23:53 UTC] amt@php.net
Duplicate of #28339.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 12 02:01:27 2024 UTC