Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit d9a0b65

Browse files
committed
Promoted deprecation test
1 parent ab06c8b commit d9a0b65

File tree

3 files changed

+43
-0
lines changed

3 files changed

+43
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
--TEST--
2+
__sleep() deprecation promoted to exception
3+
--FILE--
4+
<?php
5+
6+
set_error_handler(function ($errno, $errstr, $errfile, $errline) {
7+
throw new Exception($errstr);
8+
});
9+
10+
class Test {
11+
public function __sleep() {
12+
return [];
13+
}
14+
}
15+
16+
?>
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
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
class Test {
4+
public function __sleep() {
5+
return [];
6+
}
7+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
--TEST--
2+
___sleep() deprecation promoted to exception
3+
--FILE--
4+
<?php
5+
6+
set_error_handler(function ($errno, $errstr, $errfile, $errline) {
7+
throw new Exception($errstr);
8+
});
9+
10+
try {
11+
require __DIR__ . '/sleep_deprecation_promoted_exception2.inc';
12+
} catch (Throwable $e) {
13+
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
14+
}
15+
16+
?>
17+
--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)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /