File tree 1 file changed +38
-0
lines changed
1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ xml_error_string() - Basic test on 5 error codes
3
+ --SKIPIF--
4
+ <?php
5
+ if (!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
+
19
+ foreach ($ 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--
29
+ int(5)
30
+ string(20) "Invalid document end"
31
+ int(47)
32
+ string(35) "Processing Instruction not finished"
33
+ int(57)
34
+ string(28) "XML declaration not finished"
35
+ int(64)
36
+ string(17) "Reserved XML Name"
37
+ int(76)
38
+ string(14) "Mismatched tag"
You can’t perform that action at this time.
0 commit comments