File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -6,9 +6,11 @@ if (!extension_loaded('xml')) die('skip xml extension not available');
6
6
?>
7
7
--FILE--
8
8
<?php
9
+ // The tag mismatch at the end of the XML is on purpose, to make sure that the
10
+ // parser actually stops after the handler returns FALSE.
9
11
$ xml = <<<XML
10
12
<?xml version="1.0" encoding="UTF-8"?>
11
- <!DOCTYPE p [
13
+ <!DOCTYPE root [
12
14
<!ENTITY pic PUBLIC "image.gif" "http://example.org/image.gif">
13
15
]>
14
16
<root>
@@ -22,9 +24,9 @@ xml_set_external_entity_ref_handler($parser, function () {
22
24
return false ;
23
25
});
24
26
xml_parse ($ parser , $ xml );
25
- var_dump (xml_get_error_code ($ parser ));
27
+ var_dump (xml_get_error_code ($ parser ) === XML_ERROR_EXTERNAL_ENTITY_HANDLING );
26
28
?>
27
29
===DONE===
28
30
--EXPECT--
29
- int(21 )
31
+ bool(true )
30
32
===DONE===
You can’t perform that action at this time.
0 commit comments