diff --git a/Zend/tests/enum/__wakeup.phpt b/Zend/tests/enum/__wakeup.phpt index 8aea17ae53fd3..57b575e89f427 100644 --- a/Zend/tests/enum/__wakeup.phpt +++ b/Zend/tests/enum/__wakeup.phpt @@ -13,4 +13,6 @@ enum Foo { ?> --EXPECTF-- +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 + Fatal error: Enum Foo cannot include magic method __wakeup in %s on line %d diff --git a/Zend/tests/serialize/bug34045.phpt b/Zend/tests/serialize/bug34045.phpt index 61886cf354b67..79625a82a7b8f 100644 --- a/Zend/tests/serialize/bug34045.phpt +++ b/Zend/tests/serialize/bug34045.phpt @@ -24,5 +24,6 @@ $db_str = serialize($db); $db2 = unserialize($db_str); echo "ok\n"; ?> ---EXPECT-- +--EXPECTF-- +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 ok diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index b695f22ff3f53..c185640c46e41 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -9355,6 +9355,10 @@ static void zend_compile_class_decl(znode *result, zend_ast *ast, bool toplevel) zend_error(E_DEPRECATED, "The __sleep() serialization magic method has been deprecated." " Implement __serialize() instead (or in addition, if support for old PHP versions is necessary)"); } + if (UNEXPECTED(zend_hash_exists(&ce->function_table, ZSTR_KNOWN(ZEND_STR_WAKEUP)) && ce->__unserialize == NULL)) { + zend_error(E_DEPRECATED, "The __wakeup() serialization magic method has been deprecated." + " Implement __unserialize() instead (or in addition, if support for old PHP versions is necessary)"); + } /* We currently don't early-bind classes that implement interfaces or use traits */ if (!ce->num_interfaces && !ce->num_traits && !ce->num_hooked_prop_variance_checks diff --git a/ext/date/tests/bug62852_var2.phpt b/ext/date/tests/bug62852_var2.phpt index 4749d2a9bb21f..5e867873a31f2 100644 --- a/ext/date/tests/bug62852_var2.phpt +++ b/ext/date/tests/bug62852_var2.phpt @@ -22,6 +22,8 @@ try { var_dump( $foo ); ?> --EXPECTF-- +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 + Fatal error: Uncaught Error: Invalid serialization data for DateTime object in %sbug62852_var2.php:%d Stack trace: #0 [internal function]: DateTime->__unserialize(Array) diff --git a/ext/date/tests/bug62852_var3.phpt b/ext/date/tests/bug62852_var3.phpt index 7049efcebd84f..4130f3142fa62 100644 --- a/ext/date/tests/bug62852_var3.phpt +++ b/ext/date/tests/bug62852_var3.phpt @@ -22,6 +22,8 @@ try { var_dump( $foo ); ?> --EXPECTF-- +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 + Fatal error: Uncaught Error: Invalid serialization data for DateTime object in %sbug62852_var3.php:%d Stack trace: #0 [internal function]: DateTime->__unserialize(Array) diff --git a/ext/dom/tests/gh8996.phpt b/ext/dom/tests/gh8996.phpt index 502b27b334876..0706f2ecdecc3 100644 --- a/ext/dom/tests/gh8996.phpt +++ b/ext/dom/tests/gh8996.phpt @@ -81,6 +81,8 @@ echo "Serialized:\n-----------\n$serialized\n-----------\nRestored:\n----------- ?> --EXPECTF-- 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 + +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 === __sleep and __wakeup === string(144) "O:34:"SerializableDomDocumentSleepWakeup":1:{s:43:"%0SerializableDomDocumentSleepWakeup%0xmlData";s:39:" value diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_class.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_class.phpt index 5d53d0a05572f..4ba394cc7cd34 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_class.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_class.phpt @@ -112,6 +112,8 @@ $db->exec('DROP TABLE IF EXISTS test_stmt_fetch_class'); --EXPECTF-- 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 +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 + 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 Creating an object, serializing it and writing it to DB... myclass::singleton(Creating object) diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_serialize.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_serialize.phpt index f67707abdbe3e..455b04b4cb071 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_serialize.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_serialize.phpt @@ -109,6 +109,8 @@ $db->exec('DROP TABLE IF EXISTS test_stmt_fetch_serialize'); --EXPECTF-- 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 +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 + 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 Creating an object, serializing it and writing it to DB... myclass::singleton(Creating object) diff --git a/ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_serialize_fetch_class.phpt b/ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_serialize_fetch_class.phpt index 9ef583b0cd4f9..175f2c69e26e0 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_serialize_fetch_class.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_stmt_fetch_serialize_fetch_class.phpt @@ -112,6 +112,8 @@ $db->exec('DROP TABLE IF EXISTS test_stmt_fetchserialize_fetch_class'); --EXPECTF-- 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 +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 + 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 Creating an object, serializing it and writing it to DB... myclass::singleton(Creating object) diff --git a/ext/phar/tests/phar_metadata_write3.phpt b/ext/phar/tests/phar_metadata_write3.phpt index 304ed65b46e9f..bc3c5c45fe2f0 100644 --- a/ext/phar/tests/phar_metadata_write3.phpt +++ b/ext/phar/tests/phar_metadata_write3.phpt @@ -58,6 +58,7 @@ unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php.copy.php'); ?> --EXPECTF-- +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 Reading file contents through stream wrapper string(18) "contents of file a" Original metadata diff --git a/ext/phar/tests/phar_metadata_write4.phpt b/ext/phar/tests/phar_metadata_write4.phpt index 35b8ecba5b902..1d552ba284880 100644 --- a/ext/phar/tests/phar_metadata_write4.phpt +++ b/ext/phar/tests/phar_metadata_write4.phpt @@ -68,6 +68,8 @@ unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php.copy.php'); ?> --EXPECTF-- +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 + 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 In __destruct 1 string(1) "a" diff --git a/ext/spl/tests/SplObjectStorage/bug70365.phpt b/ext/spl/tests/SplObjectStorage/bug70365.phpt index 55ff58c9e9122..5e2ff3328ac3a 100644 --- a/ext/spl/tests/SplObjectStorage/bug70365.phpt +++ b/ext/spl/tests/SplObjectStorage/bug70365.phpt @@ -34,6 +34,7 @@ function ptr2str($ptr) } ?> --EXPECTF-- +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 array(5) { [0]=> int(1) diff --git a/ext/spl/tests/bug70366.phpt b/ext/spl/tests/bug70366.phpt index d3d3317bff370..955dea18e11b3 100644 --- a/ext/spl/tests/bug70366.phpt +++ b/ext/spl/tests/bug70366.phpt @@ -34,6 +34,7 @@ function ptr2str($ptr) } ?> --EXPECTF-- +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 array(5) { [0]=> int(1) diff --git a/ext/standard/tests/serialize/001.phpt b/ext/standard/tests/serialize/001.phpt index bdbb06133ef84..b4d2f3e841da5 100644 --- a/ext/standard/tests/serialize/001.phpt +++ b/ext/standard/tests/serialize/001.phpt @@ -79,6 +79,8 @@ var_dump($a); ?> --EXPECTF-- 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 + +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 N; b:1; b:0; diff --git a/ext/standard/tests/serialize/005.phpt b/ext/standard/tests/serialize/005.phpt index bd7d65f7a29d2..c33d6267d6d50 100644 --- a/ext/standard/tests/serialize/005.phpt +++ b/ext/standard/tests/serialize/005.phpt @@ -130,8 +130,12 @@ var_dump(unserialize('O:22:"autoload_not_available":0:{}')); --EXPECTF-- 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 +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 + 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 +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 + 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 ===O1=== TestOld::__sleep() diff --git a/ext/standard/tests/serialize/__serialize_004.phpt b/ext/standard/tests/serialize/__serialize_004.phpt index 66db8bf5044be..ef1c8582743f0 100644 --- a/ext/standard/tests/serialize/__serialize_004.phpt +++ b/ext/standard/tests/serialize/__serialize_004.phpt @@ -38,7 +38,8 @@ var_dump($s = serialize($obj)); var_dump(unserialize($s)); ?> ---EXPECT-- +--EXPECTF-- +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 string(126) "O:6:"Wakeup":1:{s:4:"data";a:1:{i:0;O:11:"Unserialize":1:{i:0;O:6:"Wakeup":1:{s:4:"data";a:1:{i:0;O:11:"Unserialize":0:{}}}}}}" __unserialize() called array(0) { diff --git a/ext/standard/tests/serialize/bug64354_2.phpt b/ext/standard/tests/serialize/bug64354_2.phpt index 675305132157e..ddb81af8be476 100644 --- a/ext/standard/tests/serialize/bug64354_2.phpt +++ b/ext/standard/tests/serialize/bug64354_2.phpt @@ -20,5 +20,6 @@ try { var_dump($e->getMessage()); } ?> ---EXPECT-- +--EXPECTF-- +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 string(6) "Failed" diff --git a/ext/standard/tests/serialize/bug65806.phpt b/ext/standard/tests/serialize/bug65806.phpt index 4d576bca685a3..3059959b1f448 100644 --- a/ext/standard/tests/serialize/bug65806.phpt +++ b/ext/standard/tests/serialize/bug65806.phpt @@ -75,6 +75,8 @@ function check(myObjC $obj) { ?> --EXPECTF-- 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 + +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 SCRIPT START check successful start serialize/unserialize diff --git a/ext/standard/tests/serialize/bug68976.phpt b/ext/standard/tests/serialize/bug68976.phpt index 514bd8b453fda..4d60bc6b7feb3 100644 --- a/ext/standard/tests/serialize/bug68976.phpt +++ b/ext/standard/tests/serialize/bug68976.phpt @@ -25,7 +25,8 @@ for($i = 0; $i < 5; $i++) { var_dump($data); ?> ---EXPECT-- +--EXPECTF-- +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 array(2) { [0]=> object(evilClass)#1 (0) { diff --git a/ext/standard/tests/serialize/bug69425.phpt b/ext/standard/tests/serialize/bug69425.phpt index 1bc79c0387c8c..6199ba394b44d 100644 --- a/ext/standard/tests/serialize/bug69425.phpt +++ b/ext/standard/tests/serialize/bug69425.phpt @@ -23,6 +23,7 @@ var_dump($data); ?> --EXPECTF-- +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 int(1) array(2) { [0]=> diff --git a/ext/standard/tests/serialize/bug70172_2.phpt b/ext/standard/tests/serialize/bug70172_2.phpt index 9bb4d83d5517e..9730d44cfc6ff 100644 --- a/ext/standard/tests/serialize/bug70172_2.phpt +++ b/ext/standard/tests/serialize/bug70172_2.phpt @@ -48,6 +48,8 @@ function ptr2str($ptr) } ?> --EXPECTF-- +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 + Deprecated: obj 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 array(2) { [0]=> diff --git a/ext/standard/tests/serialize/bug70513.phpt b/ext/standard/tests/serialize/bug70513.phpt index 9a93a3359b678..c45f61353ffbc 100644 --- a/ext/standard/tests/serialize/bug70513.phpt +++ b/ext/standard/tests/serialize/bug70513.phpt @@ -26,7 +26,8 @@ var_dump($x); var_dump($obj); ?> ---EXPECT-- +--EXPECTF-- +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 array(1) { [0]=> int(1) diff --git a/ext/standard/tests/serialize/bug72663.phpt b/ext/standard/tests/serialize/bug72663.phpt index ce767973e97f1..b92f3a1c50426 100644 --- a/ext/standard/tests/serialize/bug72663.phpt +++ b/ext/standard/tests/serialize/bug72663.phpt @@ -49,6 +49,10 @@ try { ?> --EXPECTF-- +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 + +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 + Warning: unserialize(): Error at offset 17 of 24 bytes in %s on line %d bool(false) diff --git a/ext/standard/tests/serialize/bug72731.phpt b/ext/standard/tests/serialize/bug72731.phpt index 9489928cfb128..f13103288873f 100644 --- a/ext/standard/tests/serialize/bug72731.phpt +++ b/ext/standard/tests/serialize/bug72731.phpt @@ -15,4 +15,5 @@ var_dump(unserialize($poc)); ?> --EXPECTF-- +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 %s(73588229205) diff --git a/ext/standard/tests/serialize/wakeup_deprecation_promoted_exception.phpt b/ext/standard/tests/serialize/wakeup_deprecation_promoted_exception.phpt new file mode 100644 index 0000000000000..2535148bd7d3d --- /dev/null +++ b/ext/standard/tests/serialize/wakeup_deprecation_promoted_exception.phpt @@ -0,0 +1,24 @@ +--TEST-- +__wakeup() deprecation promoted to exception +--FILE-- +getMessage(), PHP_EOL; +} + +?> +--EXPECT-- +ErrorException: The __wakeup() serialization magic method has been deprecated. Implement __unserialize() instead (or in addition, if support for old PHP versions is necessary) diff --git a/ext/standard/tests/serialize/wakeup_deprecation_promoted_exception2.inc b/ext/standard/tests/serialize/wakeup_deprecation_promoted_exception2.inc new file mode 100644 index 0000000000000..b4f8b7e42940c --- /dev/null +++ b/ext/standard/tests/serialize/wakeup_deprecation_promoted_exception2.inc @@ -0,0 +1,7 @@ +getMessage(), PHP_EOL; +} + +?> +--EXPECT-- +ErrorException: The __wakeup() serialization magic method has been deprecated. Implement __unserialize() instead (or in addition, if support for old PHP versions is necessary) \ No newline at end of file diff --git a/ext/standard/tests/strings/bug72663_3.phpt b/ext/standard/tests/strings/bug72663_3.phpt index bcec2b182a1da..d4f157cb7877e 100644 --- a/ext/standard/tests/strings/bug72663_3.phpt +++ b/ext/standard/tests/strings/bug72663_3.phpt @@ -14,5 +14,7 @@ unserialize($poc); ?> DONE --EXPECTF-- +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 + Warning: unserialize(): Error at offset 50 of 50 bytes in %s on line %d DONE