From 36bbd32afac5c2a38ec409b33505352262acefd7 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Wed, 21 Jul 2021 08:08:39 +0200 Subject: [PATCH] fix for 8.1.0beta1 - use ZEND_ACC_NOT_SERIALIZABLE instead of zend_class_serialize_deny - add return type for Iterators --- configs/yaf_config_ini.c | 18 ++++++++- configs/yaf_config_simple.c | 18 ++++++++- routes/yaf_route_map.c | 4 ++ routes/yaf_route_regex.c | 4 ++ routes/yaf_route_rewrite.c | 6 ++- routes/yaf_route_simple.c | 4 ++ routes/yaf_route_supervar.c | 7 +++- views/yaf_view_simple.c | 5 ++- yaf_application.c | 6 ++- yaf_config.c | 73 ++++++++++++++++++++++++++++++------- yaf_controller.c | 7 +++- yaf_dispatcher.c | 5 ++- yaf_loader.c | 4 ++ yaf_registry.c | 4 ++ yaf_request.c | 7 +++- yaf_response.c | 7 +++- yaf_router.c | 6 ++- yaf_session.c | 45 +++++++++++++++++++---- 18 files changed, 193 insertions(+), 37 deletions(-) diff --git a/configs/yaf_config_ini.c b/configs/yaf_config_ini.c index c94f85a8..8ede29c0 100644 --- a/configs/yaf_config_ini.c +++ b/configs/yaf_config_ini.c @@ -53,6 +53,20 @@ ZEND_BEGIN_ARG_INFO_EX(yaf_config_ini_set_arginfo, 0, 0, 2) ZEND_ARG_INFO(0, name) ZEND_ARG_INFO(0, value) ZEND_END_ARG_INFO() + +#if PHP_VERSION_ID < 80100 +#define yaf_config_ini_oget_arginfo yaf_config_ini_get_arginfo +#define yaf_config_ini_oset_arginfo yaf_config_ini_set_arginfo +#else +ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(yaf_config_ini_oget_arginfo, 0, 1, IS_MIXED, 0) + ZEND_ARG_INFO(0, name) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(yaf_config_ini_oset_arginfo, 0, 2, IS_VOID, 0) + ZEND_ARG_INFO(0, name) + ZEND_ARG_TYPE_INFO(0, value, IS_MIXED, 0) +ZEND_END_ARG_INFO() +#endif /* }}} */ static inline void yaf_deep_copy_section(zval *dst, zval *src) /* {{{ */ { @@ -508,8 +522,8 @@ zend_function_entry yaf_config_ini_methods[] = { PHP_ME(yaf_config_ini, get, yaf_config_ini_get_arginfo, ZEND_ACC_PUBLIC) PHP_ME(yaf_config_ini, set, yaf_config_ini_set_arginfo, ZEND_ACC_PUBLIC) PHP_ME(yaf_config_ini, readonly, yaf_config_ini_void_arginfo, ZEND_ACC_PUBLIC) - PHP_MALIAS(yaf_config_ini, offsetGet, get, yaf_config_ini_get_arginfo, ZEND_ACC_PUBLIC) - PHP_MALIAS(yaf_config_ini, offsetSet, set, yaf_config_ini_set_arginfo, ZEND_ACC_PUBLIC) + PHP_MALIAS(yaf_config_ini, offsetGet, get, yaf_config_ini_oget_arginfo, ZEND_ACC_PUBLIC) + PHP_MALIAS(yaf_config_ini, offsetSet, set, yaf_config_ini_oset_arginfo, ZEND_ACC_PUBLIC) PHP_MALIAS(yaf_config_ini, __set, set, yaf_config_ini_set_arginfo, ZEND_ACC_PUBLIC) {NULL, NULL, NULL} }; diff --git a/configs/yaf_config_simple.c b/configs/yaf_config_simple.c index 191f356e..a6d26834 100644 --- a/configs/yaf_config_simple.c +++ b/configs/yaf_config_simple.c @@ -47,6 +47,20 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(yaf_config_simple_unset_arginfo, 0, 0, 1) ZEND_ARG_INFO(0, name) ZEND_END_ARG_INFO() + +#if PHP_VERSION_ID < 80100 +#define yaf_config_simple_oset_arginfo yaf_config_simple_set_arginfo +#define yaf_config_simple_ounset_arginfo yaf_config_simple_unset_arginfo +#else +ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(yaf_config_simple_oset_arginfo, 0, 2, IS_VOID, 0) + ZEND_ARG_INFO(0, name) + ZEND_ARG_TYPE_INFO(0, value, IS_MIXED, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(yaf_config_simple_ounset_arginfo, 0, 1, IS_VOID, 0) + ZEND_ARG_INFO(0, name) +ZEND_END_ARG_INFO() +#endif /* }}} */ void yaf_config_simple_init(yaf_config_object *conf, zval *val, int readonly) /* {{{ */ { @@ -158,9 +172,9 @@ zend_function_entry yaf_config_simple_methods[] = { PHP_ME(yaf_config_simple, __construct, yaf_config_simple_construct_arginfo, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) PHP_ME(yaf_config_simple, set, yaf_config_simple_set_arginfo, ZEND_ACC_PUBLIC) PHP_ME(yaf_config_simple, readonly, yaf_config_simple_void_arginfo, ZEND_ACC_PUBLIC) - PHP_ME(yaf_config_simple, offsetUnset, yaf_config_simple_unset_arginfo, ZEND_ACC_PUBLIC) + PHP_ME(yaf_config_simple, offsetUnset, yaf_config_simple_ounset_arginfo, ZEND_ACC_PUBLIC) PHP_MALIAS(yaf_config_simple, __set, set, yaf_config_simple_set_arginfo, ZEND_ACC_PUBLIC) - PHP_MALIAS(yaf_config_simple, offsetSet, set, yaf_config_simple_set_arginfo, ZEND_ACC_PUBLIC) + PHP_MALIAS(yaf_config_simple, offsetSet, set, yaf_config_simple_oset_arginfo, ZEND_ACC_PUBLIC) {NULL, NULL, NULL} }; /* }}} */ diff --git a/routes/yaf_route_map.c b/routes/yaf_route_map.c index 85ec4602..41a7439b 100644 --- a/routes/yaf_route_map.c +++ b/routes/yaf_route_map.c @@ -363,9 +363,13 @@ YAF_STARTUP_FUNCTION(route_map) { YAF_INIT_CLASS_ENTRY(ce, "Yaf_Route_Map", "Yaf\\Route\\Map", yaf_route_map_methods); yaf_route_map_ce = zend_register_internal_class(&ce); yaf_route_map_ce->create_object = yaf_route_map_new; +#if PHP_VERSION_ID < 80100 yaf_route_map_ce->ce_flags |= ZEND_ACC_FINAL; yaf_route_map_ce->serialize = zend_class_serialize_deny; yaf_route_map_ce->unserialize = zend_class_unserialize_deny; +#else + yaf_route_map_ce->ce_flags |= ZEND_ACC_FINAL | ZEND_ACC_NOT_SERIALIZABLE; +#endif zend_class_implements(yaf_route_map_ce, 1, yaf_route_ce); diff --git a/routes/yaf_route_regex.c b/routes/yaf_route_regex.c index 7e2647e6..fb63a78e 100644 --- a/routes/yaf_route_regex.c +++ b/routes/yaf_route_regex.c @@ -466,9 +466,13 @@ YAF_STARTUP_FUNCTION(route_regex) { YAF_INIT_CLASS_ENTRY(ce, "Yaf_Route_Regex", "Yaf\\Route\\Regex", yaf_route_regex_methods); yaf_route_regex_ce = zend_register_internal_class(&ce); yaf_route_regex_ce->create_object = yaf_route_regex_new; +#if PHP_VERSION_ID < 80100 yaf_route_regex_ce->ce_flags |= ZEND_ACC_FINAL; yaf_route_regex_ce->serialize = zend_class_serialize_deny; yaf_route_regex_ce->unserialize = zend_class_unserialize_deny; +#else + yaf_route_regex_ce->ce_flags |= ZEND_ACC_FINAL | ZEND_ACC_NOT_SERIALIZABLE; +#endif zend_class_implements(yaf_route_regex_ce, 1, yaf_route_ce); diff --git a/routes/yaf_route_rewrite.c b/routes/yaf_route_rewrite.c index 624e4f1b..2bac1b0b 100644 --- a/routes/yaf_route_rewrite.c +++ b/routes/yaf_route_rewrite.c @@ -489,10 +489,14 @@ YAF_STARTUP_FUNCTION(route_rewrite) { zend_class_entry ce; YAF_INIT_CLASS_ENTRY(ce, "Yaf_Route_Rewrite", "Yaf\\Route\\Rewrite", yaf_route_rewrite_methods); yaf_route_rewrite_ce = zend_register_internal_class_ex(&ce, NULL); - yaf_route_rewrite_ce->ce_flags |= ZEND_ACC_FINAL; yaf_route_rewrite_ce->create_object = yaf_route_rewrite_new; +#if PHP_VERSION_ID < 80100 + yaf_route_rewrite_ce->ce_flags |= ZEND_ACC_FINAL; yaf_route_rewrite_ce->serialize = zend_class_serialize_deny; yaf_route_rewrite_ce->unserialize = zend_class_unserialize_deny; +#else + yaf_route_rewrite_ce->ce_flags |= ZEND_ACC_FINAL | ZEND_ACC_NOT_SERIALIZABLE; +#endif zend_class_implements(yaf_route_rewrite_ce, 1, yaf_route_ce); diff --git a/routes/yaf_route_simple.c b/routes/yaf_route_simple.c index da5498f1..f042d895 100644 --- a/routes/yaf_route_simple.c +++ b/routes/yaf_route_simple.c @@ -275,9 +275,13 @@ YAF_STARTUP_FUNCTION(route_simple) { YAF_INIT_CLASS_ENTRY(ce, "Yaf_Route_Simple", "Yaf\\Route\\Simple", yaf_route_simple_methods); yaf_route_simple_ce = zend_register_internal_class(&ce); yaf_route_simple_ce->create_object = yaf_route_simple_new; +#if PHP_VERSION_ID < 80100 yaf_route_simple_ce->ce_flags |= ZEND_ACC_FINAL; yaf_route_simple_ce->serialize = zend_class_serialize_deny; yaf_route_simple_ce->unserialize = zend_class_unserialize_deny; +#else + yaf_route_simple_ce->ce_flags |= ZEND_ACC_FINAL | ZEND_ACC_NOT_SERIALIZABLE; +#endif zend_class_implements(yaf_route_simple_ce, 1, yaf_route_ce); diff --git a/routes/yaf_route_supervar.c b/routes/yaf_route_supervar.c index 21bff266..946a7a65 100644 --- a/routes/yaf_route_supervar.c +++ b/routes/yaf_route_supervar.c @@ -234,11 +234,14 @@ YAF_STARTUP_FUNCTION(route_supervar) { zend_class_entry ce; YAF_INIT_CLASS_ENTRY(ce, "Yaf_Route_Supervar", "Yaf\\Route\\Supervar", yaf_route_supervar_methods); yaf_route_supervar_ce = zend_register_internal_class(&ce); - yaf_route_supervar_ce->ce_flags |= ZEND_ACC_FINAL; - yaf_route_supervar_ce->create_object = yaf_route_supervar_new; +#if PHP_VERSION_ID < 80100 + yaf_route_supervar_ce->ce_flags |= ZEND_ACC_FINAL; yaf_route_supervar_ce->serialize = zend_class_serialize_deny; yaf_route_supervar_ce->unserialize = zend_class_unserialize_deny; +#else + yaf_route_supervar_ce->ce_flags |= ZEND_ACC_FINAL | ZEND_ACC_NOT_SERIALIZABLE; +#endif zend_class_implements(yaf_route_supervar_ce, 1, yaf_route_ce); diff --git a/views/yaf_view_simple.c b/views/yaf_view_simple.c index 12419883..4abc383a 100755 --- a/views/yaf_view_simple.c +++ b/views/yaf_view_simple.c @@ -673,9 +673,12 @@ YAF_STARTUP_FUNCTION(view_simple) { YAF_INIT_CLASS_ENTRY(ce, "Yaf_View_Simple", "Yaf\\View\\Simple", yaf_view_simple_methods); yaf_view_simple_ce = zend_register_internal_class_ex(&ce, NULL); yaf_view_simple_ce->create_object = yaf_view_simple_new; +#if PHP_VERSION_ID < 80100 yaf_view_simple_ce->serialize = zend_class_serialize_deny; yaf_view_simple_ce->unserialize = zend_class_unserialize_deny; - +#else + yaf_view_simple_ce->ce_flags |= ZEND_ACC_NOT_SERIALIZABLE; +#endif zend_class_implements(yaf_view_simple_ce, 1, yaf_view_interface_ce); memcpy(&yaf_view_simple_obj_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); diff --git a/yaf_application.c b/yaf_application.c index f3e52114..e3233267 100644 --- a/yaf_application.c +++ b/yaf_application.c @@ -1084,10 +1084,14 @@ YAF_STARTUP_FUNCTION(application) { YAF_INIT_CLASS_ENTRY(ce, "Yaf_Application", "Yaf\\Application", yaf_application_methods); yaf_application_ce = zend_register_internal_class_ex(&ce, NULL); - yaf_application_ce->ce_flags |= ZEND_ACC_FINAL; yaf_application_ce->create_object = yaf_application_new; +#if PHP_VERSION_ID < 80100 + yaf_application_ce->ce_flags |= ZEND_ACC_FINAL; yaf_application_ce->serialize = zend_class_serialize_deny; yaf_application_ce->unserialize = zend_class_unserialize_deny; +#else + yaf_application_ce->ce_flags |= ZEND_ACC_FINAL | ZEND_ACC_NOT_SERIALIZABLE; +#endif memcpy(&yaf_application_obj_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); yaf_application_obj_handlers.offset = XtOffsetOf(yaf_application_object, std); diff --git a/yaf_config.c b/yaf_config.c index 8668734e..a02334b8 100644 --- a/yaf_config.c +++ b/yaf_config.c @@ -47,18 +47,61 @@ ZEND_BEGIN_ARG_INFO_EX(yaf_config_get_arginfo, 0, 0, 0) ZEND_ARG_INFO(0, name) ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_INFO_EX(yaf_config_set_arginfo, 0, 0, 2) + ZEND_ARG_INFO(0, name) + ZEND_ARG_INFO(0, value) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(yaf_config_isset_arginfo, 0, 0, 1) + ZEND_ARG_INFO(0, name) +ZEND_END_ARG_INFO() + +#if PHP_VERSION_ID < 80100 ZEND_BEGIN_ARG_INFO_EX(yaf_config_unset_arginfo, 0, 0, 1) ZEND_ARG_INFO(0, name) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(yaf_config_set_arginfo, 0, 0, 2) +#define yaf_config_current_arginfo yaf_config_void_arginfo +#define yaf_config_next_arginfo yaf_config_void_arginfo +#define yaf_config_valid_arginfo yaf_config_void_arginfo +#define yaf_config_key_arginfo yaf_config_current_arginfo +#define yaf_config_rewind_arginfo yaf_config_void_arginfo +#define yaf_config_exists_arginfo yaf_config_isset_arginfo +#define yaf_config_oget_arginfo yaf_config_get_arginfo +#define yaf_config_oset_arginfo yaf_config_set_arginfo +#define yaf_config_count_arginfo yaf_config_void_arginfo +#else +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(yaf_config_current_arginfo, 0, 0, IS_MIXED, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(yaf_config_next_arginfo, 0, 0, IS_VOID, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(yaf_config_valid_arginfo, 0, 0, _IS_BOOL, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(yaf_config_exists_arginfo, 0, 1, _IS_BOOL, 0) ZEND_ARG_INFO(0, name) - ZEND_ARG_INFO(0, value) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(yaf_config_isset_arginfo, 0, 0, 1) +ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(yaf_config_oget_arginfo, 0, 1, IS_MIXED, 0) + ZEND_ARG_INFO(0, name) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(yaf_config_oset_arginfo, 0, 2, IS_VOID, 0) + ZEND_ARG_INFO(0, name) + ZEND_ARG_TYPE_INFO(0, value, IS_MIXED, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(yaf_config_unset_arginfo, 0, 1, IS_VOID, 0) ZEND_ARG_INFO(0, name) ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(yaf_config_count_arginfo, 0, 0, IS_LONG, 0) +ZEND_END_ARG_INFO() +#define yaf_config_key_arginfo yaf_config_current_arginfo +#define yaf_config_rewind_arginfo yaf_config_next_arginfo +#endif /* }}} */ static HashTable *yaf_config_get_gc(yaf_object *obj, zval **table, int *n) /* {{{ */ { @@ -387,19 +430,19 @@ PHP_METHOD(yaf_config, valid) { */ zend_function_entry yaf_config_methods[] = { PHP_ME(yaf_config, get, yaf_config_get_arginfo, ZEND_ACC_PUBLIC) - PHP_ME(yaf_config, count, yaf_config_void_arginfo, ZEND_ACC_PUBLIC) + PHP_ME(yaf_config, count, yaf_config_count_arginfo, ZEND_ACC_PUBLIC) PHP_ME(yaf_config, toArray, yaf_config_void_arginfo, ZEND_ACC_PUBLIC) PHP_ME(yaf_config, offsetUnset, yaf_config_unset_arginfo, ZEND_ACC_PUBLIC) - PHP_ME(yaf_config, rewind, yaf_config_void_arginfo, ZEND_ACC_PUBLIC) - PHP_ME(yaf_config, current, yaf_config_void_arginfo, ZEND_ACC_PUBLIC) - PHP_ME(yaf_config, key, yaf_config_void_arginfo, ZEND_ACC_PUBLIC) - PHP_ME(yaf_config, next, yaf_config_void_arginfo, ZEND_ACC_PUBLIC) - PHP_ME(yaf_config, valid, yaf_config_void_arginfo, ZEND_ACC_PUBLIC) + PHP_ME(yaf_config, rewind, yaf_config_rewind_arginfo, ZEND_ACC_PUBLIC) + PHP_ME(yaf_config, current, yaf_config_current_arginfo, ZEND_ACC_PUBLIC) + PHP_ME(yaf_config, key, yaf_config_key_arginfo, ZEND_ACC_PUBLIC) + PHP_ME(yaf_config, next, yaf_config_next_arginfo, ZEND_ACC_PUBLIC) + PHP_ME(yaf_config, valid, yaf_config_valid_arginfo, ZEND_ACC_PUBLIC) PHP_ME(yaf_config, __isset, yaf_config_isset_arginfo, ZEND_ACC_PUBLIC) PHP_MALIAS(yaf_config, __get, get, yaf_config_get_arginfo, ZEND_ACC_PUBLIC) - PHP_MALIAS(yaf_config, offsetGet, get, yaf_config_get_arginfo, ZEND_ACC_PUBLIC) - PHP_MALIAS(yaf_config, offsetExists, __isset, yaf_config_isset_arginfo, ZEND_ACC_PUBLIC) - PHP_ABSTRACT_ME(yaf_config, offsetSet, yaf_config_set_arginfo) + PHP_MALIAS(yaf_config, offsetGet, get, yaf_config_oget_arginfo, ZEND_ACC_PUBLIC) + PHP_MALIAS(yaf_config, offsetExists, __isset, yaf_config_exists_arginfo, ZEND_ACC_PUBLIC) + PHP_ABSTRACT_ME(yaf_config, offsetSet, yaf_config_oset_arginfo) PHP_ABSTRACT_ME(yaf_config, set, yaf_config_set_arginfo) PHP_ABSTRACT_ME(yaf_config, readonly, yaf_config_void_arginfo) {NULL, NULL, NULL} @@ -413,10 +456,14 @@ YAF_STARTUP_FUNCTION(config) { YAF_INIT_CLASS_ENTRY(ce, "Yaf_Config_Abstract", "Yaf\\Config_Abstract", yaf_config_methods); yaf_config_ce = zend_register_internal_class_ex(&ce, NULL); - yaf_config_ce->ce_flags |= ZEND_ACC_EXPLICIT_ABSTRACT_CLASS; yaf_config_ce->create_object = yaf_config_new; +#if PHP_VERSION_ID < 80100 + yaf_config_ce->ce_flags |= ZEND_ACC_EXPLICIT_ABSTRACT_CLASS; yaf_config_ce->serialize = zend_class_serialize_deny; yaf_config_ce->unserialize = zend_class_unserialize_deny; +#else + yaf_config_ce->ce_flags |= ZEND_ACC_EXPLICIT_ABSTRACT_CLASS | ZEND_ACC_NOT_SERIALIZABLE; +#endif memcpy(&yaf_config_obj_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); yaf_config_obj_handlers.offset = XtOffsetOf(yaf_config_object, std); diff --git a/yaf_controller.c b/yaf_controller.c index 1f7e2303..248965f7 100644 --- a/yaf_controller.c +++ b/yaf_controller.c @@ -845,11 +845,14 @@ YAF_STARTUP_FUNCTION(controller) { zend_class_entry ce; YAF_INIT_CLASS_ENTRY(ce, "Yaf_Controller_Abstract", "Yaf\\Controller_Abstract", yaf_controller_methods); yaf_controller_ce = zend_register_internal_class_ex(&ce, NULL); - yaf_controller_ce->ce_flags |= ZEND_ACC_EXPLICIT_ABSTRACT_CLASS; - yaf_controller_ce->create_object = yaf_controller_new; +#if PHP_VERSION_ID < 80100 + yaf_controller_ce->ce_flags |= ZEND_ACC_EXPLICIT_ABSTRACT_CLASS; yaf_controller_ce->serialize = zend_class_serialize_deny; yaf_controller_ce->unserialize = zend_class_unserialize_deny; +#else + yaf_controller_ce->ce_flags |= ZEND_ACC_EXPLICIT_ABSTRACT_CLASS | ZEND_ACC_NOT_SERIALIZABLE; +#endif memcpy(&yaf_controller_obj_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); yaf_controller_obj_handlers.offset = XtOffsetOf(yaf_controller_object, std); diff --git a/yaf_dispatcher.c b/yaf_dispatcher.c index 8183de42..20a4887a 100644 --- a/yaf_dispatcher.c +++ b/yaf_dispatcher.c @@ -1340,10 +1340,13 @@ YAF_STARTUP_FUNCTION(dispatcher) { YAF_INIT_CLASS_ENTRY(ce, "Yaf_Dispatcher", "Yaf\\Dispatcher", yaf_dispatcher_methods); yaf_dispatcher_ce = zend_register_internal_class_ex(&ce, NULL); +#if PHP_VERSION_ID < 80100 yaf_dispatcher_ce->ce_flags |= ZEND_ACC_FINAL; yaf_dispatcher_ce->serialize = zend_class_serialize_deny; yaf_dispatcher_ce->unserialize = zend_class_unserialize_deny; - +#else + yaf_dispatcher_ce->ce_flags |= ZEND_ACC_FINAL | ZEND_ACC_NOT_SERIALIZABLE; +#endif memcpy(&yaf_dispatcher_obj_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); yaf_dispatcher_obj_handlers.offset = XtOffsetOf(yaf_dispatcher_object, std); yaf_dispatcher_obj_handlers.free_obj = yaf_dispatcher_obj_free; diff --git a/yaf_loader.c b/yaf_loader.c index 67a5cb69..e0faefeb 100644 --- a/yaf_loader.c +++ b/yaf_loader.c @@ -994,9 +994,13 @@ YAF_STARTUP_FUNCTION(loader) { YAF_INIT_CLASS_ENTRY(ce, "Yaf_Loader", "Yaf\\Loader", yaf_loader_methods); yaf_loader_ce = zend_register_internal_class_ex(&ce, NULL); +#if PHP_VERSION_ID < 80100 yaf_loader_ce->ce_flags |= ZEND_ACC_FINAL; yaf_loader_ce->serialize = zend_class_serialize_deny; yaf_loader_ce->unserialize = zend_class_unserialize_deny; +#else + yaf_loader_ce->ce_flags |= ZEND_ACC_FINAL | ZEND_ACC_NOT_SERIALIZABLE; +#endif memcpy(&yaf_loader_obj_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); yaf_loader_obj_handlers.clone_obj = NULL; diff --git a/yaf_registry.c b/yaf_registry.c index ac9030ac..36c3a50e 100644 --- a/yaf_registry.c +++ b/yaf_registry.c @@ -233,9 +233,13 @@ YAF_STARTUP_FUNCTION(registry) { YAF_INIT_CLASS_ENTRY(ce, "Yaf_Registry", "Yaf\\Registry", yaf_registry_methods); yaf_registry_ce = zend_register_internal_class_ex(&ce, NULL); +#if PHP_VERSION_ID < 80100 yaf_registry_ce->ce_flags |= ZEND_ACC_FINAL; yaf_registry_ce->serialize = zend_class_serialize_deny; yaf_registry_ce->unserialize = zend_class_unserialize_deny; +#else + yaf_registry_ce->ce_flags |= ZEND_ACC_FINAL | ZEND_ACC_NOT_SERIALIZABLE; +#endif memcpy(&yaf_registry_obj_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); yaf_registry_obj_handlers.offset = XtOffsetOf(yaf_registry_object, std); diff --git a/yaf_request.c b/yaf_request.c index 3a4aca50..6e758848 100644 --- a/yaf_request.c +++ b/yaf_request.c @@ -1437,11 +1437,14 @@ YAF_STARTUP_FUNCTION(request){ YAF_INIT_CLASS_ENTRY(ce, "Yaf_Request_Abstract", "Yaf\\Request_Abstract", yaf_request_methods); yaf_request_ce = zend_register_internal_class_ex(&ce, NULL); - yaf_request_ce->ce_flags |= ZEND_ACC_EXPLICIT_ABSTRACT_CLASS; - yaf_request_ce->create_object = yaf_request_new; +#if PHP_VERSION_ID < 80100 + yaf_request_ce->ce_flags |= ZEND_ACC_EXPLICIT_ABSTRACT_CLASS; yaf_request_ce->serialize = zend_class_serialize_deny; yaf_request_ce->unserialize = zend_class_unserialize_deny; +#else + yaf_request_ce->ce_flags |= ZEND_ACC_EXPLICIT_ABSTRACT_CLASS | ZEND_ACC_NOT_SERIALIZABLE; +#endif memcpy(&yaf_request_obj_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); yaf_request_obj_handlers.offset = XtOffsetOf(yaf_request_object, std); diff --git a/yaf_response.c b/yaf_response.c index dc521584..0aea6775 100755 --- a/yaf_response.c +++ b/yaf_response.c @@ -577,11 +577,14 @@ YAF_STARTUP_FUNCTION(response) { YAF_INIT_CLASS_ENTRY(ce, "Yaf_Response_Abstract", "Yaf\\Response_Abstract", yaf_response_methods); yaf_response_ce = zend_register_internal_class_ex(&ce, NULL); - yaf_response_ce->ce_flags |= ZEND_ACC_EXPLICIT_ABSTRACT_CLASS; - yaf_response_ce->create_object = yaf_response_new; +#if PHP_VERSION_ID < 80100 + yaf_response_ce->ce_flags |= ZEND_ACC_EXPLICIT_ABSTRACT_CLASS; yaf_response_ce->serialize = zend_class_serialize_deny; yaf_response_ce->unserialize = zend_class_unserialize_deny; +#else + yaf_response_ce->ce_flags |= ZEND_ACC_EXPLICIT_ABSTRACT_CLASS | ZEND_ACC_NOT_SERIALIZABLE; +#endif memcpy(&yaf_response_obj_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); yaf_response_obj_handlers.offset = XtOffsetOf(yaf_response_object, std); diff --git a/yaf_router.c b/yaf_router.c index 4d3e9d91..3cf6deda 100644 --- a/yaf_router.c +++ b/yaf_router.c @@ -424,10 +424,14 @@ YAF_STARTUP_FUNCTION(router) { YAF_INIT_CLASS_ENTRY(ce, "Yaf_Router", "Yaf\\Router", yaf_router_methods); yaf_router_ce = zend_register_internal_class_ex(&ce, NULL); - yaf_router_ce->ce_flags |= ZEND_ACC_FINAL; yaf_router_ce->create_object = yaf_router_new; +#if PHP_VERSION_ID < 80100 + yaf_router_ce->ce_flags |= ZEND_ACC_FINAL; yaf_router_ce->serialize = zend_class_serialize_deny; yaf_router_ce->unserialize = zend_class_unserialize_deny; +#else + yaf_router_ce->ce_flags |= ZEND_ACC_FINAL | ZEND_ACC_NOT_SERIALIZABLE; +#endif memcpy(&yaf_router_obj_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); yaf_router_obj_handlers.offset = XtOffsetOf(yaf_router_object, std); diff --git a/yaf_session.c b/yaf_session.c index 3dd7c9e5..4e04def4 100644 --- a/yaf_session.c +++ b/yaf_session.c @@ -54,6 +54,34 @@ ZEND_BEGIN_ARG_INFO_EX(yaf_session_set_arginfo, 0, 0, 2) ZEND_ARG_INFO(0, name) ZEND_ARG_INFO(0, value) ZEND_END_ARG_INFO() + +#if PHP_VERSION_ID < 80100 +#define yaf_session_oexists_arginfo yaf_session_has_arginfo +#define yaf_session_oget_arginfo yaf_session_get_arginfo +#define yaf_session_oset_arginfo yaf_session_set_arginfo +#define yaf_session_ounset_arginfo yaf_session_del_arginfo +#define yaf_session_count_arginfo yaf_session_void_arginfo +#else +ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(yaf_session_oexists_arginfo, 0, 1, _IS_BOOL, 0) + ZEND_ARG_INFO(0, name) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(yaf_session_oget_arginfo, 0, 1, IS_MIXED, 0) + ZEND_ARG_INFO(0, name) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(yaf_session_oset_arginfo, 0, 2, IS_VOID, 0) + ZEND_ARG_INFO(0, name) + ZEND_ARG_TYPE_INFO(0, value, IS_MIXED, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(yaf_session_ounset_arginfo, 0, 1, IS_VOID, 0) + ZEND_ARG_INFO(0, name) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(yaf_session_count_arginfo, 0, 0, IS_LONG, 0) +ZEND_END_ARG_INFO() +#endif /* }}} */ static inline void yaf_session_start(yaf_session_object *session) /* {{{ */ { @@ -318,12 +346,12 @@ zend_function_entry yaf_session_methods[] = { PHP_ME(yaf_session, has, yaf_session_has_arginfo, ZEND_ACC_PUBLIC) PHP_ME(yaf_session, set, yaf_session_set_arginfo, ZEND_ACC_PUBLIC) PHP_ME(yaf_session, del, yaf_session_del_arginfo, ZEND_ACC_PUBLIC) - PHP_ME(yaf_session, count, yaf_session_void_arginfo, ZEND_ACC_PUBLIC) + PHP_ME(yaf_session, count, yaf_session_count_arginfo, ZEND_ACC_PUBLIC) PHP_ME(yaf_session, clear, yaf_session_void_arginfo, ZEND_ACC_PUBLIC) - PHP_MALIAS(yaf_session, offsetGet, get, yaf_session_get_arginfo, ZEND_ACC_PUBLIC) - PHP_MALIAS(yaf_session, offsetSet, set, yaf_session_set_arginfo, ZEND_ACC_PUBLIC) - PHP_MALIAS(yaf_session, offsetExists, has, yaf_session_has_arginfo, ZEND_ACC_PUBLIC) - PHP_MALIAS(yaf_session, offsetUnset, del, yaf_session_del_arginfo, ZEND_ACC_PUBLIC) + PHP_MALIAS(yaf_session, offsetGet, get, yaf_session_oget_arginfo, ZEND_ACC_PUBLIC) + PHP_MALIAS(yaf_session, offsetSet, set, yaf_session_oset_arginfo, ZEND_ACC_PUBLIC) + PHP_MALIAS(yaf_session, offsetExists, has, yaf_session_oexists_arginfo, ZEND_ACC_PUBLIC) + PHP_MALIAS(yaf_session, offsetUnset, del, yaf_session_ounset_arginfo, ZEND_ACC_PUBLIC) PHP_MALIAS(yaf_session, __get, get, yaf_session_get_arginfo, ZEND_ACC_PUBLIC) PHP_MALIAS(yaf_session, __isset, has, yaf_session_has_arginfo, ZEND_ACC_PUBLIC) PHP_MALIAS(yaf_session, __set, set, yaf_session_set_arginfo, ZEND_ACC_PUBLIC) @@ -340,11 +368,14 @@ YAF_STARTUP_FUNCTION(session) { YAF_INIT_CLASS_ENTRY(ce, "Yaf_Session", "Yaf\\Session", yaf_session_methods); yaf_session_ce = zend_register_internal_class_ex(&ce, NULL); - yaf_session_ce->ce_flags |= ZEND_ACC_FINAL; - yaf_session_ce->get_iterator = yaf_session_get_iterator; +#if PHP_VERSION_ID < 80100 + yaf_session_ce->ce_flags |= ZEND_ACC_FINAL; yaf_session_ce->serialize = zend_class_serialize_deny; yaf_session_ce->unserialize = zend_class_unserialize_deny; +#else + yaf_session_ce->ce_flags |= ZEND_ACC_FINAL | ZEND_ACC_NOT_SERIALIZABLE; +#endif memcpy(&yaf_session_obj_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); yaf_session_obj_handlers.offset = XtOffsetOf(yaf_session_object, std);