From: kellan at pobox dot com Operating system: any (tested on os x and debian) PHP version: 5.0.3 PHP Bug Type: XML related Bug description: PHP5 freezes when parsing XML document without prolog
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 bug report at http://bugs.php.net/?id=32087&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32087&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=32087&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=32087&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=32087&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=32087&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=32087&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=32087&r=needscript Try newer version: http://bugs.php.net/fix.php?id=32087&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=32087&r=support Expected behavior: http://bugs.php.net/fix.php?id=32087&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=32087&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=32087&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=32087&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32087&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=32087&r=dst IIS Stability: http://bugs.php.net/fix.php?id=32087&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=32087&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=32087&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=32087&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=32087&r=mysqlcfg