diff --git a/NEWS b/NEWS index 393aab037a216..ba76d468a8b0e 100644 --- a/NEWS +++ b/NEWS @@ -38,6 +38,11 @@ PHP NEWS . INI settings session.sid_length and session.sid_bits_per_character are now deprecated. (timwolla) +- SPL: + . The SplFixedArray::__wakeup() method has been deprecated as it implements + __serialize() and __unserialize() which need to be overwritten instead. + (TysonAndre) + - Standard: . Unserializing the uppercase 'S' tag is now deprecated. (timwolla) diff --git a/UPGRADING b/UPGRADING index 51705677354f6..46cfbcdc4ffe4 100644 --- a/UPGRADING +++ b/UPGRADING @@ -463,6 +463,10 @@ PHP 8.4 UPGRADE NOTES hexadecimal session IDs and stop changing these two INI settings. RFC: https://wiki.php.net/rfc/deprecations_php_8_4 +- SPL: + . The SplFixedArray::__wakeup() method has been deprecated as it implements + __serialize() and __unserialize() which need to be overwritten instead. + - Standard: . Calling stream_context_set_option() with 2 arguments is deprecated. Use stream_context_set_options() instead. diff --git a/ext/spl/spl_fixedarray.c b/ext/spl/spl_fixedarray.c index 368b5e5d10dce..96a09309f305e 100644 --- a/ext/spl/spl_fixedarray.c +++ b/ext/spl/spl_fixedarray.c @@ -22,6 +22,7 @@ #include "php.h" #include "zend_interfaces.h" #include "zend_exceptions.h" +#include "zend_attributes.h" #include "spl_fixedarray_arginfo.h" #include "spl_fixedarray.h" diff --git a/ext/spl/spl_fixedarray.stub.php b/ext/spl/spl_fixedarray.stub.php index 8ca6497be085c..a5a239ab4d69c 100644 --- a/ext/spl/spl_fixedarray.stub.php +++ b/ext/spl/spl_fixedarray.stub.php @@ -6,10 +6,8 @@ class SplFixedArray implements IteratorAggregate, ArrayAccess, Countable, JsonSe { public function __construct(int $size = 0) {} - /** - * @tentative-return-type - * @deprecated - */ + /** @tentative-return-type */ + #[\Deprecated(since: '8.4', message: 'this method is obsolete, as serialization hooks are provided by __unserialize() and __serialize()')] public function __wakeup(): void {} public function __serialize(): array {} diff --git a/ext/spl/spl_fixedarray_arginfo.h b/ext/spl/spl_fixedarray_arginfo.h index aa92494a8f7d9..f71ec74adf205 100644 --- a/ext/spl/spl_fixedarray_arginfo.h +++ b/ext/spl/spl_fixedarray_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 453f55b59c0b61f2c8a41b17694be74c3e0a6171 */ + * Stub hash: a251ed19168eddf1d45a74d25104e92585669f5e */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SplFixedArray___construct, 0, 0, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, size, IS_LONG, 0, "0") @@ -97,5 +97,18 @@ static zend_class_entry *register_class_SplFixedArray(zend_class_entry *class_en class_entry = zend_register_internal_class_ex(&ce, NULL); zend_class_implements(class_entry, 4, class_entry_IteratorAggregate, class_entry_ArrayAccess, class_entry_Countable, class_entry_JsonSerializable); + + zend_attribute *attribute_Deprecated_func___wakeup_0 = zend_add_function_attribute(zend_hash_str_find_ptr(&class_entry->function_table, "__wakeup", sizeof("__wakeup") - 1), ZSTR_KNOWN(ZEND_STR_DEPRECATED), 2); + zval attribute_Deprecated_func___wakeup_0_arg0; + zend_string *attribute_Deprecated_func___wakeup_0_arg0_str = zend_string_init("8.4", strlen("8.4"), 1); + ZVAL_STR(&attribute_Deprecated_func___wakeup_0_arg0, attribute_Deprecated_func___wakeup_0_arg0_str); + ZVAL_COPY_VALUE(&attribute_Deprecated_func___wakeup_0->args[0].value, &attribute_Deprecated_func___wakeup_0_arg0); + attribute_Deprecated_func___wakeup_0->args[0].name = ZSTR_KNOWN(ZEND_STR_SINCE); + zval attribute_Deprecated_func___wakeup_0_arg1; + zend_string *attribute_Deprecated_func___wakeup_0_arg1_str = zend_string_init("the __unserialize() method must be overloaded instead", strlen("the __unserialize() method must be overloaded instead"), 1); + ZVAL_STR(&attribute_Deprecated_func___wakeup_0_arg1, attribute_Deprecated_func___wakeup_0_arg1_str); + ZVAL_COPY_VALUE(&attribute_Deprecated_func___wakeup_0->args[1].value, &attribute_Deprecated_func___wakeup_0_arg1); + attribute_Deprecated_func___wakeup_0->args[1].name = ZSTR_KNOWN(ZEND_STR_MESSAGE); + return class_entry; }