Skip to content

Commit 2816a3f

Browse files
committed
Fix and improve test case
We fix the erroneous doctype declaration, clarify the expectation, and add a comment to clarify the purpose of the tag mismatch in the XML.
1 parent 17df3a1 commit 2816a3f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

ext/xml/tests/bug71592.phpt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ if (!extension_loaded('xml')) die('skip xml extension not available');
66
?>
77
--FILE--
88
<?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.
911
$xml = <<<XML
1012
<?xml version="1.0" encoding="UTF-8"?>
11-
<!DOCTYPE p [
13+
<!DOCTYPE root [
1214
<!ENTITY pic PUBLIC "image.gif" "http://example.org/image.gif">
1315
]>
1416
<root>
@@ -22,9 +24,9 @@ xml_set_external_entity_ref_handler($parser, function () {
2224
return false;
2325
});
2426
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);
2628
?>
2729
===DONE===
2830
--EXPECT--
29-
int(21)
31+
bool(true)
3032
===DONE===

0 commit comments

Comments
 (0)