From e1557c8f219651550633567054af9c3298524c7e Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Mon, 19 Sep 2022 11:44:33 +0200 Subject: [PATCH 1/3] Fix PHP 8.2 compatibility --- requests/yaf_request_simple.c | 3 +++ tests/031.phpt | 2 +- tests/issue231.phpt | 2 +- views/yaf_view_simple.c | 4 +++- yaf_application.c | 4 +++- 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/requests/yaf_request_simple.c b/requests/yaf_request_simple.c index 6e7ff540..9c63d1c4 100644 --- a/requests/yaf_request_simple.c +++ b/requests/yaf_request_simple.c @@ -140,6 +140,9 @@ YAF_STARTUP_FUNCTION(request_simple){ zend_class_entry ce; YAF_INIT_CLASS_ENTRY(ce, "Yaf_Request_Simple", "Yaf\\Request\\Simple", yaf_request_simple_methods); yaf_request_simple_ce = zend_register_internal_class_ex(&ce, yaf_request_ce); +#if PHP_VERSION_ID >= 80200 + yaf_request_simple_ce->ce_flags |= ZEND_ACC_ALLOW_DYNAMIC_PROPERTIES; +#endif return SUCCESS; } diff --git a/tests/031.phpt b/tests/031.phpt index 19e9f79f..3474aa63 100644 --- a/tests/031.phpt +++ b/tests/031.phpt @@ -36,7 +36,7 @@ Array ) array ( '_default' => - Yaf_Route_Map::__set_state(array( + %saf_Route_Map::__set_state(array( 'ctl_prefer:protected' => true, 'delimiter:protected' => '##', )), diff --git a/tests/issue231.phpt b/tests/issue231.phpt index da656f87..44abc592 100644 --- a/tests/issue231.phpt +++ b/tests/issue231.phpt @@ -34,7 +34,7 @@ Yaf_Request_Http Object ) ) -Yaf_Request_Http::__set_state(array( +%saf_Request_Http::__set_state(array( 'method' => 'POST', 'module' => NULL, 'controller' => NULL, diff --git a/views/yaf_view_simple.c b/views/yaf_view_simple.c index 229339e9..7402fed7 100755 --- a/views/yaf_view_simple.c +++ b/views/yaf_view_simple.c @@ -388,8 +388,10 @@ static int yaf_view_simple_eval(yaf_view_t *view, zend_string *tpl, zval * vars, ZVAL_STR(&phtml, strpprintf(0, "?>%s", ZSTR_VAL(tpl))); #if PHP_VERSION_ID < 80000 op_array = zend_compile_string(&phtml, eval_desc); -#else +#elif PHP_VERSION_ID < 80200 op_array = zend_compile_string(Z_STR(phtml), eval_desc); +#else + op_array = zend_compile_string(Z_STR(phtml), eval_desc, ZEND_COMPILE_POSITION_AFTER_OPEN_TAG); #endif zval_dtor(&phtml); efree(eval_desc); diff --git a/yaf_application.c b/yaf_application.c index 44b8e9e8..335b6d44 100644 --- a/yaf_application.c +++ b/yaf_application.c @@ -1053,8 +1053,10 @@ YAF_STARTUP_FUNCTION(application) { 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 +#elif PHP_VERSION_ID < 80200 yaf_application_ce->ce_flags |= ZEND_ACC_FINAL | ZEND_ACC_NOT_SERIALIZABLE; +#else + yaf_application_ce->ce_flags |= ZEND_ACC_FINAL | ZEND_ACC_NOT_SERIALIZABLE | ZEND_ACC_ALLOW_DYNAMIC_PROPERTIES; #endif memcpy(&yaf_application_obj_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); From 866f31e4916214dcafacbf2bb5035b6c046095aa Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Thu, 14 Sep 2023 13:15:59 +0200 Subject: [PATCH 2/3] ZEND_HOT removed in 8.3 --- php_yaf.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/php_yaf.h b/php_yaf.h index 3585421e..9cd6e3a7 100644 --- a/php_yaf.h +++ b/php_yaf.h @@ -260,6 +260,11 @@ static zend_always_inline uint32_t yaf_compose_2_pathes(char *buf, zend_string * } #endif +/* removed in 8.3 */ +#ifndef ZEND_HOT +#define ZEND_HOT +#endif + /* * Local variables: * tab-width: 4 From cd933d806d0016c8cadcc0c2f0996ebdc2e5d4b8 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Mon, 19 Feb 2024 11:01:23 +0100 Subject: [PATCH 3/3] Fix [-Wincompatible-pointer-types] with 7.4 --- php_yaf.h | 4 ++++ yaf.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/php_yaf.h b/php_yaf.h index 9cd6e3a7..6c1174e4 100644 --- a/php_yaf.h +++ b/php_yaf.h @@ -74,7 +74,11 @@ extern zend_module_entry yaf_module_entry; #else #define YAF_WRITE_HANDLER zval * #define YAF_WHANDLER_RET(zv) return zv +#if PHP_VERSION_ID >= 80000 HashTable *yaf_fake_get_gc(zend_object *zobj, zval **table, int *n); +#else +HashTable *yaf_fake_get_gc(zval *zobj, zval **table, int *n); +#endif #endif #if PHP_VERSION_ID < 80000 diff --git a/yaf.c b/yaf.c index d59cdfe5..e7e1b9d8 100644 --- a/yaf.c +++ b/yaf.c @@ -72,7 +72,11 @@ void yaf_iterator_dtor(zend_object_iterator *iter) /* {{{ */ { /* }}} */ #if PHP_VERSION_ID >= 70400 +#if PHP_VERSION_ID >= 80000 HashTable *yaf_fake_get_gc(zend_object *zobj, zval **table, int *n) /* {{{ */ { +#else +HashTable *yaf_fake_get_gc(zval *zobj, zval **table, int *n) /* {{{ */ { +#endif *n = 0; *table = NULL; return NULL;