Skip to content

Commit d76578f

Browse files
committed
Review
1 parent d9a0b65 commit d76578f

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

ext/standard/tests/serialize/sleep_deprecation_promoted_exception.phpt

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,21 @@ __sleep() deprecation promoted to exception
44
<?php
55

66
set_error_handler(function ($errno, $errstr, $errfile, $errline) {
7-
throw new Exception($errstr);
7+
throw new ErrorException($errstr);
88
});
99

10-
class Test {
11-
public function __sleep() {
12-
return [];
10+
try {
11+
eval(<<<'CODE'
12+
class Test {
13+
public function __sleep() {
14+
return [];
15+
}
1316
}
17+
CODE);
18+
} catch (Throwable $e) {
19+
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
1420
}
1521

1622
?>
17-
--EXPECTF--
18-
Deprecated: The __sleep() serialization magic method has been deprecated. Implement __serialize() instead (or in addition, if support for old PHP versions is necessary) in %s on line %d
23+
--EXPECT--
24+
ErrorException: The __sleep() serialization magic method has been deprecated. Implement __serialize() instead (or in addition, if support for old PHP versions is necessary)

ext/standard/tests/serialize/sleep_deprecation_promoted_exception2.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ ___sleep() deprecation promoted to exception
44
<?php
55

66
set_error_handler(function ($errno, $errstr, $errfile, $errline) {
7-
throw new Exception($errstr);
7+
throw new ErrorException($errstr);
88
});
99

1010
try {
@@ -15,4 +15,4 @@ try {
1515

1616
?>
1717
--EXPECT--
18-
Exception: The __sleep() serialization magic method has been deprecated. Implement __serialize() instead (or in addition, if support for old PHP versions is necessary)
18+
ErrorException: The __sleep() serialization magic method has been deprecated. Implement __serialize() instead (or in addition, if support for old PHP versions is necessary)

0 commit comments

Comments
 (0)