mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Drop serial denier functions
This commit is contained in:
parent
c50f4dece0
commit
322864b569
5 changed files with 6 additions and 24 deletions
|
@ -49,8 +49,7 @@ PHP 8.1 INTERNALS UPGRADE NOTES
|
||||||
macro. Replace ZEND_ATOL(i, s) with i = ZEND_ATOL(s).
|
macro. Replace ZEND_ATOL(i, s) with i = ZEND_ATOL(s).
|
||||||
f. Non-serializable classes should be indicated using the
|
f. Non-serializable classes should be indicated using the
|
||||||
ZEND_ACC_NOT_SERIALIZABLE (@not-serializable in stubs) rather than the
|
ZEND_ACC_NOT_SERIALIZABLE (@not-serializable in stubs) rather than the
|
||||||
zend_class_(un)serialize_deny handlers. Support for the serialization
|
zend_class_(un)serialize_deny handlers which are removed.
|
||||||
handlers will be dropped in the future.
|
|
||||||
|
|
||||||
========================
|
========================
|
||||||
2. Build system changes
|
2. Build system changes
|
||||||
|
|
|
@ -403,21 +403,6 @@ ZEND_API int zend_user_unserialize(zval *object, zend_class_entry *ce, const uns
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
ZEND_API int zend_class_serialize_deny(zval *object, unsigned char **buffer, size_t *buf_len, zend_serialize_data *data) /* {{{ */
|
|
||||||
{
|
|
||||||
zend_class_entry *ce = Z_OBJCE_P(object);
|
|
||||||
zend_throw_exception_ex(NULL, 0, "Serialization of '%s' is not allowed", ZSTR_VAL(ce->name));
|
|
||||||
return FAILURE;
|
|
||||||
}
|
|
||||||
/* }}} */
|
|
||||||
|
|
||||||
ZEND_API int zend_class_unserialize_deny(zval *object, zend_class_entry *ce, const unsigned char *buf, size_t buf_len, zend_unserialize_data *data) /* {{{ */
|
|
||||||
{
|
|
||||||
zend_throw_exception_ex(NULL, 0, "Unserialization of '%s' is not allowed", ZSTR_VAL(ce->name));
|
|
||||||
return FAILURE;
|
|
||||||
}
|
|
||||||
/* }}} */
|
|
||||||
|
|
||||||
/* {{{ zend_implement_serializable */
|
/* {{{ zend_implement_serializable */
|
||||||
static int zend_implement_serializable(zend_class_entry *interface, zend_class_entry *class_type)
|
static int zend_implement_serializable(zend_class_entry *interface, zend_class_entry *class_type)
|
||||||
{
|
{
|
||||||
|
@ -623,8 +608,6 @@ ZEND_API void zend_register_interfaces(void)
|
||||||
|
|
||||||
zend_ce_internal_iterator = register_class_InternalIterator(zend_ce_iterator);
|
zend_ce_internal_iterator = register_class_InternalIterator(zend_ce_iterator);
|
||||||
zend_ce_internal_iterator->create_object = zend_internal_iterator_create;
|
zend_ce_internal_iterator->create_object = zend_internal_iterator_create;
|
||||||
zend_ce_internal_iterator->serialize = zend_class_serialize_deny;
|
|
||||||
zend_ce_internal_iterator->unserialize = zend_class_unserialize_deny;
|
|
||||||
|
|
||||||
memcpy(&zend_internal_iterator_handlers, zend_get_std_object_handlers(),
|
memcpy(&zend_internal_iterator_handlers, zend_get_std_object_handlers(),
|
||||||
sizeof(zend_object_handlers));
|
sizeof(zend_object_handlers));
|
||||||
|
|
|
@ -64,9 +64,6 @@ ZEND_API void zend_register_interfaces(void);
|
||||||
ZEND_API int zend_user_serialize(zval *object, unsigned char **buffer, size_t *buf_len, zend_serialize_data *data);
|
ZEND_API int zend_user_serialize(zval *object, unsigned char **buffer, size_t *buf_len, zend_serialize_data *data);
|
||||||
ZEND_API int zend_user_unserialize(zval *object, zend_class_entry *ce, const unsigned char *buf, size_t buf_len, zend_unserialize_data *data);
|
ZEND_API int zend_user_unserialize(zval *object, zend_class_entry *ce, const unsigned char *buf, size_t buf_len, zend_unserialize_data *data);
|
||||||
|
|
||||||
ZEND_API int zend_class_serialize_deny(zval *object, unsigned char **buffer, size_t *buf_len, zend_serialize_data *data);
|
|
||||||
ZEND_API int zend_class_unserialize_deny(zval *object, zend_class_entry *ce, const unsigned char *buf, size_t buf_len, zend_unserialize_data *data);
|
|
||||||
|
|
||||||
ZEND_API zend_result zend_create_internal_iterator_zval(zval *return_value, zval *obj);
|
ZEND_API zend_result zend_create_internal_iterator_zval(zval *return_value, zval *obj);
|
||||||
|
|
||||||
END_EXTERN_C()
|
END_EXTERN_C()
|
||||||
|
|
|
@ -66,6 +66,9 @@ interface Stringable
|
||||||
public function __toString(): string;
|
public function __toString(): string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @not-serializable
|
||||||
|
*/
|
||||||
final class InternalIterator implements Iterator
|
final class InternalIterator implements Iterator
|
||||||
{
|
{
|
||||||
private function __construct() {}
|
private function __construct() {}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* This is a generated file, edit the .stub.php file instead.
|
/* This is a generated file, edit the .stub.php file instead.
|
||||||
* Stub hash: 339e326a82a7fd1e2ae419c8c86095e29028fbd6 */
|
* Stub hash: a9c915c11e5989d8c7cf2d704ada09ca765670c3 */
|
||||||
|
|
||||||
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_OBJ_INFO_EX(arginfo_class_IteratorAggregate_getIterator, 0, 0, Traversable, 0)
|
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_OBJ_INFO_EX(arginfo_class_IteratorAggregate_getIterator, 0, 0, Traversable, 0)
|
||||||
ZEND_END_ARG_INFO()
|
ZEND_END_ARG_INFO()
|
||||||
|
@ -208,7 +208,7 @@ static zend_class_entry *register_class_InternalIterator(zend_class_entry *class
|
||||||
|
|
||||||
INIT_CLASS_ENTRY(ce, "InternalIterator", class_InternalIterator_methods);
|
INIT_CLASS_ENTRY(ce, "InternalIterator", class_InternalIterator_methods);
|
||||||
class_entry = zend_register_internal_class_ex(&ce, NULL);
|
class_entry = zend_register_internal_class_ex(&ce, NULL);
|
||||||
class_entry->ce_flags |= ZEND_ACC_FINAL;
|
class_entry->ce_flags |= ZEND_ACC_FINAL|ZEND_ACC_NOT_SERIALIZABLE;
|
||||||
zend_class_implements(class_entry, 1, class_entry_Iterator);
|
zend_class_implements(class_entry, 1, class_entry_Iterator);
|
||||||
|
|
||||||
return class_entry;
|
return class_entry;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue