Skip to content

Commit 3b52787

Browse files
committed
Add test for GH-18022
1 parent c07640d commit 3b52787

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

Zend/tests/gh18022.phpt

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
--TEST--
2+
Test
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+
class Clazz {
11+
#[\Deprecated(self::TEST)]
12+
public const TEST = -"from itself";
13+
14+
#[\Deprecated]
15+
public const TEST2 = "from another";
16+
17+
#[\Deprecated(self::TEST2)]
18+
public const TEST3 = 1;
19+
}
20+
21+
try {
22+
Clazz::TEST;
23+
} catch (ErrorException $e) {
24+
echo "Caught: ", $e->getMessage(), PHP_EOL;
25+
}
26+
27+
try {
28+
Clazz::TEST3;
29+
} catch (ErrorException $e) {
30+
echo "Caught: ", $e->getMessage(), PHP_EOL;
31+
}
32+
33+
?>
34+
--EXPECTF--
35+
Fatal error: Uncaught TypeError: Unsupported operand types: int * string in %s:%d
36+
Stack trace:
37+
#0 %s(%d): [constant expression]()
38+
#1 {main}
39+
thrown in %s on line %d

0 commit comments

Comments
 (0)