php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30746 simplexml_load_file fails if the data contains the '&' or '<' or '>' character
Submitted: 2004-11-10 14:13 UTC Modified: 2004-11-10 14:25 UTC
From: manoj_smartsoft at rediffmail dot com Assigned:
Status: Not a bug Package: *XML functions
PHP Version: 5.0.2 OS: Windows-XP
Private report: No CVE-ID: None
 [2004-11-10 14:13 UTC] manoj_smartsoft at rediffmail dot com
Description:
------------
If the XML file conatinx &,< or > in the data field, then the simplexml_load_file fails

Reproduce code:
---------------
// * bug_file.xml : START * //
<?xml version='1.0' standalone='yes'?>
<couples>
<couple>
   <name>John&Marry</name>
   <age>John>Marry</age>
</couple>
</couples>

// * bug_file.xml : END * //
<?php

$xml = simplexml_load_file("bug_file.xml");

echo $xml->couple[0]->name; // "So this language. It's ike..."
?> 

Expected result:
----------------
This should give me the following result

John&Marry

Actual result:
--------------
The actual result is that, the function returns error.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-11-10 14:25 UTC] manoj_smartsoft at rediffmail dot com
To avoid this use the ascii values

go to http://webdesign.about.com/library/bl_htmlcodes.htm
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 14 13:01:26 2024 UTC