#35027 [Opn->Bgs]: Specific proper XML code breaks xml parser
| From: | chregu@php.net | Date: | Mon, 31 Oct 2005 05:31:45 +0000 |
| Subject: | #35027 [Opn->Bgs]: Specific proper XML code breaks xml parser | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-87241@lists.php.net to get a copy of this message | ||
ID: 35027
Updated by: chregu@php.net
Reported By: php at puntloos dot nl
-Status: Open
+Status: Bogus
Bug Type: XML related
Operating System: Linux Debian 2.6.13
PHP Version: 5.0.5
New Comment:
fread does not necessarly give you 1400000 bytes back, but
max. this amount of data. use file_get_contents or loop
through fread.
You would have realized that error with a simple "print $data"
...
And btw, there's no xml version=2.0.
Previous Comments:
------------------------------------------------------------------------
[2005-10-30 19:47:00] php at puntloos dot nl
Normally I would be the first to say that my XML is lacking, at best,
so maybe it's just bad XML that can be found by snipping off parts of
the code until the error goes away.
But I've tried that.
If you remove -any- of the ITEMs of my 'break.rss' the situation fixes
itself, so *I* cant narrow it down beyond what's in break.rss.
------------------------------------------------------------------------
[2005-10-30 19:08:20] php at puntloos dot nl
Description:
------------
I've got a specific, properly formatted (as far as I can tell) RSS file
that breaks the XML parser.
Reproduce code:
---------------
<?php
$url="http://130.89.22.201/break.rss";
$data=@fread(fopen("$url","r"),140000) or die("Cant open $url!");
$myar=getXmlData($data);
function getXmlData($xml_doc) {
$parser = xml_parser_create();
xml_parse_into_struct($parser,$xml_doc,$vals,$index) or
die(xml_error_string(xml_get_error_code($parser)));
xml_parser_free($parser);
}
?>
Expected result:
----------------
I expect it not to produce "Invalid document end" with the rss file
(http://130.89.22.201/break.rss)
Actual result:
--------------
It procudes "Invalid document end" :P
Somehow it seems to do with the total size of the RSS file but I've
parsed way bigger files.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=35027&edit=1