|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-08-14 10:52 UTC] chregu@php.net
[2004-08-19 14:39 UTC] chregu@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 19:00:01 2025 UTC |
Description: ------------ when validating an incorrectly formated xml file, the errors from php 5.0.0 are vaguely descriptive, outputting some constant name and not a human readable error message Reproduce code: --------------- #!/usr/bin/php5 <?php if ($argc<2) { echo "Usage: ".$PHP_SELF." file.xml\n"; exit; } $file = $argv[1]; $depth = array(); function startElement($parser, $name, $attrs) {} function endElement($parser, $name) {} $xml_parser = xml_parser_create(); xml_set_element_handler($xml_parser, "startElement", "endElement"); if (!($fp = fopen($file, "r"))) { die("could not open XML input"); } while ($data = fread($fp, 4096)) { if (!xml_parse($xml_parser, $data, feof($fp))) { die(sprintf("XML error: %s at line %d", xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser))); } } xml_parser_free($xml_parser); Expected result: ---------------- XML error: mismatched tag at line 14 (from php4, identical code) Actual result: -------------- XML error: XML_ERR_TAG_NAME_MISMATCH at line 14 (php5 output)