php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27541 SimpleXML fails to load an xml file which contains html entities
Submitted: 2004-03-09 13:00 UTC Modified: 2004-03-09 18:25 UTC
From: silver_dragoon77 at hotmail dot com Assigned:
Status: Not a bug Package: SimpleXML related
PHP Version: 5.0.0b4 (beta4) OS: WinXP
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 this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: silver_dragoon77 at hotmail dot com
New email:
PHP Version: OS:

 

 [2004-03-09 13:00 UTC] silver_dragoon77 at hotmail dot com
Description:
------------
The example string given at the php simple xml manual page contains actór (spanish stress on the "o"). simplexml_load_string or even simplexml_load_file both fail. If I remove the ó it works fine.

Reproduce code:
---------------
$xmlstr = <<<XML
<?xml version='1.0' standalone='yes'?>
<movies>
 <movie>
  <title>PHP: Behind the Parser</title>
  <characters>
   <character>
    <name>Ms. Coder</name>
    <actor>Onlivia Actora</actor>
   </character>
   <character>
    <name>Mr. Coder</name>
    <actor>El Actor</actor>
   </character>
  </characters>
  <plot>
   So, this language. It's like, a programming language. Or is it a
   scripting language? All is revealed in this thrilling horror spoof
   of a documentary.
  </plot>
  <rating type="thumbs">7</rating>
  <rating type="stars">5</rating>
 </movie>
</movies>
XML;

$xml = simplexml_load_string($xmlstr);
var_dump($xml);

Expected result:
----------------
var_dump should return a simplexml object

Actual result:
--------------
$xml is bool(false)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-03-09 13:25 UTC] silver_dragoon77 at hotmail dot com
Ooops sorry I didn't realize that my file wasn't unicode encoded !
 [2004-03-09 18:25 UTC] iliaa@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

XML parsers cannot understand html entities, you must use 
&#[number]; to represent 'special' characters. 
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 07:01:28 2024 UTC