From: fuddyq at gmail dot com Operating system: Windows2000 PHP version: 5.0.2 PHP Bug Type: XML related Bug description: xml_parse_into_struct won't parse data read from a file
Description: ------------ When using the documentation for xml_parse_into_struct to test xml read from a file, the function appears to unsuccessfully parse the data. The xml file is valid xml, is being read properly and can be dumped by it's fread variable $data. I can copy and paste the xml into the $data variable and the function will work properly. The xml_error_string(xml_get_error_code($parser)) is "Empty Document" which is incorrect. Reproduce code: --------------- $xml_file = 'someXMLfile.xml'; $filehandler = fopen($xml_file, 'r'); $data = fread($filehandler, filesize($xml_file)); fclose($filehandler); $parser = xml_parser_create(); xml_parse_into_struct($parser, $data, $vals, $index); xml_parser_free($parser); echo "Index array\n"; print_r($index); echo "\nVals array\n"; print_r($vals); Expected result: ---------------- Similar results to the documentation for the xml_parse_into_struct() function via print_r(). Actual result: -------------- Index array Array ( ) Vals array Array ( ) -- Edit bug report at http://bugs.php.net/?id=31589&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=31589&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=31589&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=31589&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=31589&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=31589&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=31589&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=31589&r=needscript Try newer version: http://bugs.php.net/fix.php?id=31589&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=31589&r=support Expected behavior: http://bugs.php.net/fix.php?id=31589&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=31589&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=31589&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=31589&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=31589&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=31589&r=dst IIS Stability: http://bugs.php.net/fix.php?id=31589&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=31589&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=31589&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=31589&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=31589&r=mysqlcfg