summaryrefslogtreecommitdiffstats
path: root/0003-Fix-for-PHP-8.5.patch
blob: d38d12de248302177e96aeed77bd8804b1408500 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
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