Skip to content

Commit f18e992

Browse files
authored
1 parent 0e2c991 commit f18e992

35 files changed

+115
-11
lines changed

Zend/tests/enum/__sleep.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,6 @@ 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+
1618
Fatal error: Enum Foo cannot include magic method __sleep in %s on line %d

Zend/tests/lazy_objects/oss_fuzz_71446.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@ $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: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ 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
3940
Init on serialize and successful initialization
4041
string(27) "O:1:"C":1:{s:4:"%0C%0b";i:1;}"
4142
Init on serialize and failed initialization

Zend/tests/lazy_objects/serialize___sleep_initializes.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ $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
4041
# Ghost:
4142
string(11) "initializer"
4243
string(24) "O:1:"C":1:{s:1:"a";i:1;}"

Zend/tests/lazy_objects/serialize___sleep_skip_flag.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ $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
3839
# Ghost:
3940
string(12) "O:1:"C":0:{}"
4041
object(C)#%d (0) {

Zend/tests/lazy_objects/serialize___sleep_skip_flag_may_initialize.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ $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
4142
# Ghost:
4243
string(11) "initializer"
4344
int(1)

Zend/zend_compile.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9351,6 +9351,11 @@ static void zend_compile_class_decl(znode *result, zend_ast *ast, bool toplevel)
93519351
ce->ce_flags |= ZEND_ACC_TOP_LEVEL;
93529352
}
93539353

9354+
if (ce->__serialize == NULL && zend_hash_exists(&ce->function_table, ZSTR_KNOWN(ZEND_STR_SLEEP))) {
9355+
zend_error(E_DEPRECATED, "The __sleep() serialization magic method has been deprecated."
9356+
" Implement __serialize() instead (or in addition, if support for old PHP versions is necessary)");
9357+
}
9358+
93549359
/* We currently don't early-bind classes that implement interfaces or use traits */
93559360
if (!ce->num_interfaces && !ce->num_traits && !ce->num_hooked_prop_variance_checks
93569361
#ifdef ZEND_OPCACHE_SHM_REATTACHMENT

ext/dom/tests/gh8996.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ echo "Serialized:\n-----------\n$serialized\n-----------\nRestored:\n-----------
8080

8181
?>
8282
--EXPECTF--
83+
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
8384
=== __sleep and __wakeup ===
8485
string(144) "O:34:"SerializableDomDocumentSleepWakeup":1:{s:43:"%0SerializableDomDocumentSleepWakeup%0xmlData";s:39:"<?xml version="1.0"?>
8586
<tag>value</tag>

ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_class.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ $db = MySQLPDOTest::factory();
110110
$db->exec('DROP TABLE IF EXISTS test_stmt_fetch_class');
111111
?>
112112
--EXPECTF--
113+
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
114+
113115
Deprecated: %s implements the Serializable interface, which is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary) in %s on line %d
114116
Creating an object, serializing it and writing it to DB...
115117
myclass::singleton(Creating object)

ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_serialize.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ $db = MySQLPDOTest::factory();
107107
$db->exec('DROP TABLE IF EXISTS test_stmt_fetch_serialize');
108108
?>
109109
--EXPECTF--
110+
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
111+
110112
Deprecated: %s implements the Serializable interface, which is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary) in %s on line %d
111113
Creating an object, serializing it and writing it to DB...
112114
myclass::singleton(Creating object)

0 commit comments

Comments
 (0)