diff options
Diffstat (limited to '0003-Fix-for-PHP-8.5.patch')
-rw-r--r-- | 0003-Fix-for-PHP-8.5.patch | 129 |
1 files changed, 129 insertions, 0 deletions
diff --git a/0003-Fix-for-PHP-8.5.patch b/0003-Fix-for-PHP-8.5.patch new file mode 100644 index 0000000..d38d12d --- /dev/null +++ b/0003-Fix-for-PHP-8.5.patch @@ -0,0 +1,129 @@ +From af27b18c2112114b2dfd18e535ceb1846282823a Mon Sep 17 00:00:00 2001 +From: Remi Collet <remi@remirepo.net> +Date: Fri, 18 Jul 2025 10:18:56 +0200 +Subject: [PATCH 3/3] Fix for PHP 8.5 + +- use zend_ce_exception instead of zend_exception_get_default +- use ZSTR_ALLOCA_* instead of STR_ALLOCA_* +- relax test expectation in error message +--- + tests/104.phpt | 2 +- + yaf_dispatcher.c | 18 +++++++++--------- + yaf_exception.c | 2 +- + yaf_request.c | 2 +- + 4 files changed, 12 insertions(+), 12 deletions(-) + +diff --git a/tests/104.phpt b/tests/104.phpt +index 797a35a..6eb545c 100644 +--- a/tests/104.phpt ++++ b/tests/104.phpt +@@ -174,4 +174,4 @@ string(%s) "Failed opening action script %sindex.php: No such file or directory" + string(61) "Action 'IndexAction' is not a subclass of Yaf_Action_Abstract" + string(61) "Action 'IndexAction' is not a subclass of Yaf_Action_Abstract" + +-Fatal error: Class FooAction contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (Yaf_Action_Abstract::execute) in %sfoo.php on line %d ++Fatal error: Class FooAction contains 1 abstract method and must therefore be declared abstract or implement the remaining method%s(Yaf_Action_Abstract::execute) in %sfoo.php on line %d +diff --git a/yaf_dispatcher.c b/yaf_dispatcher.c +index 6bf98f9..c585bb0 100644 +--- a/yaf_dispatcher.c ++++ b/yaf_dispatcher.c +@@ -21,7 +21,7 @@ + #include "php.h" + #include "main/SAPI.h" /* for sapi_module */ + #include "Zend/zend_interfaces.h" /* for zend_call_method_with_* */ +-#include "Zend/zend_exceptions.h" /* for zend_exception_get_default */ ++#include "Zend/zend_exceptions.h" /* for zend_ce_exception */ + + #include "php_yaf.h" + #include "yaf_namespace.h" +@@ -355,7 +355,7 @@ static zend_class_entry *yaf_dispatcher_get_controller(zend_string *app_dir, yaf + directory_len += yaf_compose_2_pathes(directory + directory_len, module, ZEND_STRL(YAF_CONTROLLER_DIRECTORY_NAME)); + } + +- STR_ALLOCA_ALLOC(lc_name, ZSTR_LEN(controller) + YAF_G(name_separator_len) + sizeof("controller") - 1, use_heap); ++ ZSTR_ALLOCA_ALLOC(lc_name, ZSTR_LEN(controller) + YAF_G(name_separator_len) + sizeof("controller") - 1, use_heap); + if (EXPECTED(yaf_is_name_suffix())) { + char *p = ZSTR_VAL(lc_name); + zend_str_tolower_copy(p, ZSTR_VAL(controller), ZSTR_LEN(controller)); +@@ -381,15 +381,15 @@ static zend_class_entry *yaf_dispatcher_get_controller(zend_string *app_dir, yaf + if (yaf_loader_load_internal(l, ZSTR_VAL(controller), ZSTR_LEN(controller), directory, directory_len)) { + if (EXPECTED((ce = zend_hash_find_ptr(EG(class_table), lc_name)))) { + if (EXPECTED(instanceof_function(ce, yaf_controller_ce))) { +- STR_ALLOCA_FREE(lc_name, use_heap); ++ ZSTR_ALLOCA_FREE(lc_name, use_heap); + return ce; + } + } + } +- STR_ALLOCA_FREE(lc_name, use_heap); ++ ZSTR_ALLOCA_FREE(lc_name, use_heap); + return yaf_dispatcher_get_errors_hub(1, ce, controller, directory, directory_len); + } +- STR_ALLOCA_FREE(lc_name, use_heap); ++ ZSTR_ALLOCA_FREE(lc_name, use_heap); + return ce; + } + /* }}} */ +@@ -417,7 +417,7 @@ static zend_class_entry *yaf_dispatcher_get_action(zend_string *app_dir, yaf_con + zend_string *lc_name; + ALLOCA_FLAG(use_heap); + +- STR_ALLOCA_ALLOC(lc_name, ZSTR_LEN(action) + YAF_G(name_separator_len) + sizeof("action") - 1, use_heap); ++ ZSTR_ALLOCA_ALLOC(lc_name, ZSTR_LEN(action) + YAF_G(name_separator_len) + sizeof("action") - 1, use_heap); + if (EXPECTED(yaf_is_name_suffix())) { + char *p = ZSTR_VAL(lc_name); + memcpy(p, ZSTR_VAL(action), ZSTR_LEN(action)); +@@ -440,7 +440,7 @@ static zend_class_entry *yaf_dispatcher_get_action(zend_string *app_dir, yaf_con + + if ((ce = zend_hash_find_ptr(EG(class_table), lc_name)) != NULL) { + if (EXPECTED(instanceof_function(ce, yaf_action_ce))) { +- STR_ALLOCA_FREE(lc_name, use_heap); ++ ZSTR_ALLOCA_FREE(lc_name, use_heap); + return ce; + } + } else if (((pzval = zend_hash_find_ind(Z_ARRVAL_P(actions_map), action)) != NULL) && +@@ -453,13 +453,13 @@ static zend_class_entry *yaf_dispatcher_get_action(zend_string *app_dir, yaf_con + if (yaf_loader_import(path, len)) { + if ((ce = zend_hash_find_ptr(EG(class_table), lc_name)) != NULL) { + if (EXPECTED(instanceof_function(ce, yaf_action_ce))) { +- STR_ALLOCA_FREE(lc_name, use_heap); ++ ZSTR_ALLOCA_FREE(lc_name, use_heap); + return ce; + } + } + } + } +- STR_ALLOCA_FREE(lc_name, use_heap); ++ ZSTR_ALLOCA_FREE(lc_name, use_heap); + } + + return yaf_dispatcher_get_errors_hub(2, ce, actions_map, action, controller, path); +diff --git a/yaf_exception.c b/yaf_exception.c +index e987756..9e25b5b 100644 +--- a/yaf_exception.c ++++ b/yaf_exception.c +@@ -73,7 +73,7 @@ zend_class_entry * yaf_get_exception_base(int root) /* {{{ */ { + } + #endif + +- return zend_exception_get_default(); ++ return zend_ce_exception; + } + /* }}} */ + +diff --git a/yaf_request.c b/yaf_request.c +index e4869c5..372823a 100644 +--- a/yaf_request.c ++++ b/yaf_request.c +@@ -21,7 +21,7 @@ + #include "php.h" + #include "main/SAPI.h" + #include "standard/php_string.h" /* for php_basename */ +-#include "Zend/zend_exceptions.h" /* for zend_exception_get_default */ ++#include "Zend/zend_exceptions.h" /* for zend_ce_exception */ + #include "Zend/zend_interfaces.h" /* for zend_class_serialize_deny */ + #include "Zend/zend_smart_str.h" + +-- +2.50.1 + |