Skip to content

Commit e6c3a6c

Browse files
beberleiTimWolla
authored andcommitted
Add test showing behavior when deprecations are converted to exeptions is right.
1 parent f9dc405 commit e6c3a6c

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+
#[Deprecated] attribute with user error handler converting to exceptions
3+
--FILE--
4+
<?php
5+
6+
set_error_handler(function (int $errno, string $errstr, ?string $errfile = null, ?int $errline = null) {
7+
throw new \ErrorException($errstr, 0, $errno, $errfile, $errline);
8+
});
9+
10+
#[Deprecated("convert to exception")]
11+
function test() {
12+
}
13+
14+
try {
15+
test();
16+
} catch (ErrorException $e) {
17+
echo $e;
18+
}
19+
20+
?>
21+
--EXPECTF--
22+
ErrorException: Function test() is deprecated, convert to exception in %s:%d
23+
Stack trace:
24+
#0 %s(%d): {closure:%s:%d}(8192, 'Function test()...', '%s', 12)
25+
#1 {main}%A

0 commit comments

Comments
 (0)