ID: 32087
Comment by: mbonetti at gmail dot com
Reported By: kellan at pobox dot com
Status: Open
Bug Type: XML related
Operating System: any (tested on os x and debian)
PHP Version: 5.0.3
New Comment:
Freezing doesn't happen with the provided code snipped, unless you
replace $xml1 with $xml2 in the xml_parse() call.
Reproduced on OS X 10.3.8, php 5.0.2 (both cli and web module), libxml
2.5.4
Previous Comments:
------------------------------------------------------------------------
[2005-02-23 23:16:52] kellan at pobox dot com
Description:
------------
When parsing a XML document without a prolog PHP5 seems to "freeze",
never returning from xml_parse and never calling the call backs. This
is reproducible on both Debian/PHP 5.0.2 with libxml 2.6.11 and Mac OS
X/PHP 5.0.3 with libxml 2.6.7
I've attached the simplest possible example to demonstrate this
(probably best to run it from the command line, but the problem is
reproducible running under Apache and from the command line)
Reproduce code:
---------------
<?php
$xml1 = '<?xml version="1.0"?><greeting>hello world</greeting>';
$xml2 = '<greeting>hello world</greeting>';
$parser = xml_parser_create('');
xml_set_element_handler($parser, "startElement", "endElement");
$status = xml_parse($parser, $xml1, true);
function startElement($parser, $name, $attrs) {
echo "start $name\n";
}
function endElement($parser, $name) {
echo "end $name\n";
}
?>
Expected result:
----------------
I would expect to see the program echo "GREETING", and then end. This
is what happens when you run this same script under PHP4
Actual result:
--------------
It just sits there until you kill it.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=32087&edit=1