Skip to content

Commit fc35396

Browse files
Revert deprecation of __sleep and __wakeup (#19966)
1 parent 3419c17 commit fc35396

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+17
-216
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ PHP NEWS
77
. Fixed bug GH-20002 (Broken build on *BSD with MSAN). (outtersg)
88
. Fixed bug GH-19352 (Cross-compilation with musl C library).
99
(henderkes, Peter Kokot)
10+
. Revert deprecation of __sleep() and __wakeup().
11+
They're now soft-deprecated. (Nicolas Grekas)
1012

1113
- BcMath:
1214
. Fixed bug GH-20006 (Power of 0 of BcMath number causes UB). (nielsdos)

UPGRADING

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,10 +401,11 @@ PHP 8.5 UPGRADE NOTES
401401
$_GET or $_SERVER['QUERY_STRING'] to access the information, after verifying
402402
that the usage is safe.
403403
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_the_register_argc_argv_ini_directive
404-
. The __sleep() and __wakeup() magic methods have been deprecated. The
404+
. The __sleep() and __wakeup() magic methods have been soft-deprecated. The
405405
__serialize() and __unserialize() magic methods should be used instead,
406406
or at the same time if compatibility with PHP 7 is required.
407407
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_the_sleep_and_wakeup_magic_methods
408+
RFC: https://wiki.php.net/rfc/soft-deprecate-sleep-wakeup
408409

409410
- Curl:
410411
. The curl_close() function has been deprecated, as CurlHandle objects are

Zend/tests/enum/__sleep.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,4 @@ enum Foo {
1313

1414
?>
1515
--EXPECTF--
16-
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
17-
1816
Fatal error: Enum Foo cannot include magic method __sleep in %s on line %d

Zend/tests/enum/__wakeup.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,4 @@ enum Foo {
1313

1414
?>
1515
--EXPECTF--
16-
Deprecated: The __wakeup() serialization magic method has been deprecated. Implement __unserialize() instead (or in addition, if support for old PHP versions is necessary) in %s on line %d
17-
1816
Fatal error: Enum Foo cannot include magic method __wakeup in %s on line %d

Zend/tests/lazy_objects/oss_fuzz_71446.phpt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,3 @@ $obj = $reflector->newLazyProxy(function() {
2020
serialize($obj);
2121
?>
2222
--EXPECTF--
23-
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

Zend/tests/lazy_objects/serialize___sleep.phpt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ try {
3636

3737
?>
3838
--EXPECTF--
39-
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
4039
Init on serialize and successful initialization
4140
string(27) "O:1:"C":1:{s:4:"%0C%0b";i:1;}"
4241
Init on serialize and failed initialization

Zend/tests/lazy_objects/serialize___sleep_initializes.phpt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ $obj = $reflector->newLazyProxy(function ($obj) {
3737
test('Proxy', $obj);
3838

3939
--EXPECTF--
40-
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
4140
# Ghost:
4241
string(11) "initializer"
4342
string(24) "O:1:"C":1:{s:1:"a";i:1;}"

Zend/tests/lazy_objects/serialize___sleep_skip_flag.phpt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ $obj = $reflector->newLazyProxy(function ($obj) {
3535
test('Proxy', $obj);
3636

3737
--EXPECTF--
38-
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
3938
# Ghost:
4039
string(12) "O:1:"C":0:{}"
4140
object(C)#%d (0) {

Zend/tests/lazy_objects/serialize___sleep_skip_flag_may_initialize.phpt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ $obj = $reflector->newLazyProxy(function ($obj) {
3838
test('Proxy', $obj);
3939

4040
--EXPECTF--
41-
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
4241
# Ghost:
4342
string(11) "initializer"
4443
int(1)

Zend/tests/serialize/bug34045.phpt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,5 @@ $db_str = serialize($db);
2424
$db2 = unserialize($db_str);
2525
echo "ok\n";
2626
?>
27-
--EXPECTF--
28-
Deprecated: The __wakeup() serialization magic method has been deprecated. Implement __unserialize() instead (or in addition, if support for old PHP versions is necessary) in %s on line %d
27+
--EXPECT--
2928
ok

0 commit comments

Comments
 (0)