php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #25549 xml_parse() function error
Submitted: 2003-09-15 16:06 UTC Modified: 2003-09-15 18:17 UTC
From: choor at bigmir dot net Assigned:
Status: Not a bug Package: *XML functions
PHP Version: 4.3.3 OS: FreeBSD 4.7-RELEASE & Windows XP
Private report: No CVE-ID: None
 [2003-09-15 16:06 UTC] choor at bigmir dot net
Description:
------------
xml_parse() function error.
This error appears every time xml_parse() function found "&"(ampersand) in xml-content.

XML file Example:
10: ...
11: <item>
12: <title>Command & Conquer: Generals</title>
13:  <txt>Command & Conquer: Generals - Game Addon</txt>
14:  <category>Games/Red Alert</category>
15: </item>
16: ...

This error will occur in line 12, if I cut '&' there then error will occur in line 13.
If I cut all '&' no errors will occur.

Reproduce code:
---------------
Standart code from PHP manual:
if (!xml_parse($xml_parser, $data, feof($fp)))
{
  die(sprintf("XML error: %s at line %d",
  xml_error_string(xml_get_error_code($xml_parser)),
  xml_get_current_line_number($xml_parser)));
}

Expected result:
----------------
Formated HTML text.

Actual result:
--------------
XML error: not well-formed (invalid token) at line 12

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-09-15 18:17 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

& should be &amp; in valid XML.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 30 14:01:28 2024 UTC