Skip to content

Commit caae950

Browse files
committed
ext/xml: Add an explicit test case about unsetting a handler with empty string
1 parent b0091c4 commit caae950

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
--TEST--
2+
Unsetting a handler via an empty string should emit a deprecation
3+
--EXTENSIONS--
4+
xml
5+
--FILE--
6+
<?php
7+
8+
/* Use xml_set_processing_instruction_handler() for generic implementation */
9+
function dummy() {}
10+
11+
/* Create valid parser */
12+
$parser = xml_parser_create();
13+
xml_set_processing_instruction_handler($parser, dummy(...));
14+
15+
try {
16+
xml_set_processing_instruction_handler($parser, '');
17+
} catch (\Throwable $e) {
18+
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
19+
}
20+
21+
?>
22+
END
23+
--EXPECTF--
24+
Deprecated: xml_set_processing_instruction_handler(): Passing non-callable strings is deprecated since 8.4 in %s on line %d
25+
END

0 commit comments

Comments
 (0)