ext/spl: Follow-up on GH-9704 (#15295)

Co-authored-by: Tim Düsterhus <timwolla@googlemail.com>
This commit is contained in:
Gina Peter Banyard 2024-08-08 19:31:51 +01:00 committed by GitHub
parent bb2836eced
commit c8b45aa59a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 26 additions and 5 deletions

5
NEWS
View file

@ -41,6 +41,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)

View file

@ -467,6 +467,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.

View file

@ -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"

View file

@ -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 {}

View file

@ -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;
}