1--TEST-- 2xml_error_string() - Basic test on 5 error codes 3--SKIPIF-- 4<?php 5if (!extension_loaded('xml')) { 6 exit('Skip - XML extension not loaded'); 7} 8?> 9--FILE-- 10<?php 11$xmls = array( 12 '<?xml version="1.0"?><element>', 13 '<?xml>', 14 '<?xml version="dummy">', 15 '<?xml?>', 16 '<?xml version="1.0"?><elem></element>', 17); 18 19foreach ($xmls as $xml) { 20 $xml_parser = xml_parser_create(); 21 if (!xml_parse($xml_parser, $xml, true)) { 22 var_dump(xml_get_error_code($xml_parser)); 23 var_dump(xml_error_string(xml_get_error_code($xml_parser))); 24 } 25 xml_parser_free($xml_parser); 26} 27?> 28--EXPECT-- 29int(5) 30string(20) "Invalid document end" 31int(47) 32string(35) "Processing Instruction not finished" 33int(57) 34string(28) "XML declaration not finished" 35int(64) 36string(17) "Reserved XML Name" 37int(76) 38string(14) "Mismatched tag" 39