XML error reporting bug

From: Date: Thu, 28 Oct 1999 05:34:01 +0000
Subject: XML error reporting bug
Groups: php.dev 
Request: Send a blank email to php-dev+get-11945@lists.php.net to get a copy of this message
This message was sent from Geocrawler.com by "Brad Jackson" <brad_jackson@inlet.com> Be sure to reply to that address. If there is a mismatched tag in XML and the parsing fails, when calling xml_get_current_line_number or xml_get_current_column_number, the results are not consistent between runs. Here's a code sample and results. I've noticed that if I initialize $done to FALSE, it doesn't happen, but I don't know how that could be related. I also tried shortening the XML sample, but then it doesn't happen either. I've seen XML errors in the past that would cause Apache to seg fault when calling the functions to get details about the XML error and this may be the same problem. <?php $xml = "<ABCDEFGH>\n<ABCDEFGHIJKLM>1234567890</ABCDEFGHIJKLM>\n<ABCDEFGH>"; // Note last closing tag should be "</ABCDEFGH>" while(!$done) { for($i = 0; $i < 2; $i++) { $xmlParser = xml_parser_create(); xml_parse($xmlParser, $xml, TRUE); $pass[$i]["Line"] = xml_get_current_line_number($xmlParser); $pass[$i]["Column"] = xml_get_current_column_number($xmlParser); xml_parser_free($xmlParser); } if($pass[0]["Line"] != $pass[1]["Line"] || $pass[0]["Column"] != $pass[1]["Column"]) { echo "Pass1: Line " . $pass[0]["Line"] . ", Column " . $pass[0]["Column"] . "<br>"; echo "Pass2: Line " . $pass[1]["Line"] . ", Column " . $pass[1]["Column"]; $done = TRUE; } } ?> Typical results: Pass1: Line 3, Column 10 Pass2: Line 2, Column 52 Pass1: Line 1, Column 63 Pass2: Line 3, Column 10 Geocrawler.com - The Knowledge Archive

« previous php.dev (#11945) next »