summaryrefslogtreecommitdiffstats
path: root/varnish-php8.patch
blob: e5a8152ee8f5aa88657732268415133068791f95 (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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
Index: php_varnish.h
===================================================================
--- pecl/varnish/trunk/php_varnish.h	2018/07/01 11:30:53	345257
+++ pecl/varnish/trunk/php_varnish.h	2020/08/24 14:11:30	350373
@@ -131,6 +131,14 @@
 	int authok;
 };
 
+#if PHP_MAJOR_VERSION >= 8
+#define TSRMLS_D void
+#define TSRMLS_DC
+#define TSRMLS_C
+#define TSRMLS_CC
+#define TSRMLS_FETCH()
+#endif
+
 #if PHP_MAJOR_VERSION >= 7
 struct ze_varnish_adm_obj {
 	struct ze_varnish_conn zvc;
Index: varnish.c
===================================================================
--- pecl/varnish/trunk/varnish.c	(révision 350372)
+++ pecl/varnish/trunk/varnish.c	(copie de travail)
@@ -40,6 +40,24 @@
 
 #include "varnish_lib.h"
 
+/* Compatibility with PHP < 8 */
+#if PHP_VERSION_ID < 70200
+#undef  ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX
+#endif
+
+#ifndef ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX
+#define ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(name, return_reference, required_num_args, type, allow_null) \
+        ZEND_BEGIN_ARG_INFO_EX(name, _unused, return_reference, required_num_args)
+#endif
+
+#ifndef ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE
+#define ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(pass_by_ref, name, type_hint, allow_null, default_value) \
+        ZEND_ARG_TYPE_INFO(pass_by_ref, name, type_hint, allow_null)
+#endif 
+
+/* Arginfo generated with PHP 8 */ 
+#include "varnish_arginfo.h"
+
 /*ZEND_DECLARE_MODULE_GLOBALS(varnish)*/
 
 /* True global resources - no need for thread safety here
@@ -70,27 +88,27 @@
 /* {{{ VarnishAdmin_methods[]
  */
 const zend_function_entry VarnishAdmin_methods[] = {
-	PHP_ME(VarnishAdmin, __construct, NULL, ZEND_ACC_PUBLIC)
-	PHP_ME(VarnishAdmin, connect, NULL, ZEND_ACC_PUBLIC)
-	PHP_ME(VarnishAdmin, auth, NULL, ZEND_ACC_PUBLIC)
-	PHP_ME(VarnishAdmin, getParams, NULL, ZEND_ACC_PUBLIC)
-	PHP_ME(VarnishAdmin, setParam, NULL, ZEND_ACC_PUBLIC)
-	PHP_ME(VarnishAdmin, stop, NULL, ZEND_ACC_PUBLIC)
-	PHP_ME(VarnishAdmin, start, NULL, ZEND_ACC_PUBLIC)
-	PHP_ME(VarnishAdmin, banUrl, NULL, ZEND_ACC_PUBLIC)
-	PHP_ME(VarnishAdmin, ban, NULL, ZEND_ACC_PUBLIC)
-	PHP_ME(VarnishAdmin, isRunning, NULL, ZEND_ACC_PUBLIC)
-	PHP_ME(VarnishAdmin, getPanic, NULL, ZEND_ACC_PUBLIC)
-	PHP_ME(VarnishAdmin, clearPanic, NULL, ZEND_ACC_PUBLIC)
-	PHP_ME(VarnishAdmin, setHost, NULL, ZEND_ACC_PUBLIC)
-	PHP_ME(VarnishAdmin, setIdent, NULL, ZEND_ACC_PUBLIC)
-	PHP_ME(VarnishAdmin, setTimeout, NULL, ZEND_ACC_PUBLIC)
-	PHP_ME(VarnishAdmin, setPort, NULL, ZEND_ACC_PUBLIC)
-	PHP_ME(VarnishAdmin, setSecret, NULL, ZEND_ACC_PUBLIC)
-	PHP_ME(VarnishAdmin, setCompat, NULL, ZEND_ACC_PUBLIC)
-	PHP_ME(VarnishAdmin, getVclList, NULL, ZEND_ACC_PUBLIC)
-	PHP_ME(VarnishAdmin, vclUse, NULL, ZEND_ACC_PUBLIC)
-	PHP_ME(VarnishAdmin, disconnect, NULL, ZEND_ACC_PUBLIC)
+	PHP_ME(VarnishAdmin, __construct, arginfo_class_VarnishAdmin___construct, ZEND_ACC_PUBLIC)
+	PHP_ME(VarnishAdmin, connect, arginfo_class_VarnishAdmin_connect, ZEND_ACC_PUBLIC)
+	PHP_ME(VarnishAdmin, auth, arginfo_class_VarnishAdmin_auth, ZEND_ACC_PUBLIC)
+	PHP_ME(VarnishAdmin, getParams, arginfo_class_VarnishAdmin_getParams, ZEND_ACC_PUBLIC)
+	PHP_ME(VarnishAdmin, setParam, arginfo_class_VarnishAdmin_setParam, ZEND_ACC_PUBLIC)
+	PHP_ME(VarnishAdmin, stop, arginfo_class_VarnishAdmin_stop, ZEND_ACC_PUBLIC)
+	PHP_ME(VarnishAdmin, start, arginfo_class_VarnishAdmin_start, ZEND_ACC_PUBLIC)
+	PHP_ME(VarnishAdmin, banUrl, arginfo_class_VarnishAdmin_banUrl, ZEND_ACC_PUBLIC)
+	PHP_ME(VarnishAdmin, ban, arginfo_class_VarnishAdmin_ban, ZEND_ACC_PUBLIC)
+	PHP_ME(VarnishAdmin, isRunning, arginfo_class_VarnishAdmin_isRunning, ZEND_ACC_PUBLIC)
+	PHP_ME(VarnishAdmin, getPanic, arginfo_class_VarnishAdmin_getPanic, ZEND_ACC_PUBLIC)
+	PHP_ME(VarnishAdmin, clearPanic, arginfo_class_VarnishAdmin_clearPanic, ZEND_ACC_PUBLIC)
+	PHP_ME(VarnishAdmin, setHost, arginfo_class_VarnishAdmin_setHost, ZEND_ACC_PUBLIC)
+	PHP_ME(VarnishAdmin, setIdent, arginfo_class_VarnishAdmin_setIdent, ZEND_ACC_PUBLIC)
+	PHP_ME(VarnishAdmin, setTimeout, arginfo_class_VarnishAdmin_setTimeout, ZEND_ACC_PUBLIC)
+	PHP_ME(VarnishAdmin, setPort, arginfo_class_VarnishAdmin_setPort, ZEND_ACC_PUBLIC)
+	PHP_ME(VarnishAdmin, setSecret, arginfo_class_VarnishAdmin_setSecret, ZEND_ACC_PUBLIC)
+	PHP_ME(VarnishAdmin, setCompat, arginfo_class_VarnishAdmin_setCompat, ZEND_ACC_PUBLIC)
+	PHP_ME(VarnishAdmin, getVclList, arginfo_class_VarnishAdmin_getVclList, ZEND_ACC_PUBLIC)
+	PHP_ME(VarnishAdmin, vclUse, arginfo_class_VarnishAdmin_vclUse, ZEND_ACC_PUBLIC)
+	PHP_ME(VarnishAdmin, disconnect, arginfo_class_VarnishAdmin_disconnect, ZEND_ACC_PUBLIC)
 	{NULL, NULL, NULL}
 };
 /* }}} */
@@ -97,9 +115,9 @@
 
 /* {{{ VarnishStat_methods{} */
 const zend_function_entry VarnishStat_methods[] = {
-	PHP_ME(VarnishStat, __construct, NULL, ZEND_ACC_PUBLIC)
+	PHP_ME(VarnishStat, __construct, arginfo_class_VarnishStat___construct, ZEND_ACC_PUBLIC)
 #if defined(HAVE_VARNISHAPILIB) && HAVE_VARNISHAPILIB < 40
-	PHP_ME(VarnishStat, getSnapshot, NULL, ZEND_ACC_PUBLIC)
+	PHP_ME(VarnishStat, getSnapshot, arginfo_class_VarnishStat_getSnapshot, ZEND_ACC_PUBLIC)
 #endif
 	{NULL, NULL, NULL}
 };
@@ -107,10 +125,10 @@
 
 /* {{{ VarnishLog_methods{} */
 const zend_function_entry VarnishLog_methods[] = {
-	PHP_ME(VarnishLog, __construct, NULL, ZEND_ACC_PUBLIC)
+	PHP_ME(VarnishLog, __construct, arginfo_class_VarnishLog___construct, ZEND_ACC_PUBLIC)
 #if defined(HAVE_VARNISHAPILIB) && HAVE_VARNISHAPILIB < 40
-	PHP_ME(VarnishLog, getLine, NULL, ZEND_ACC_PUBLIC)
-	PHP_ME(VarnishLog, getTagName, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
+	PHP_ME(VarnishLog, getLine, arginfo_class_VarnishLog_getLine, ZEND_ACC_PUBLIC)
+	PHP_ME(VarnishLog, getTagName, arginfo_class_VarnishLog_getTagName, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
 #endif
 	{NULL, NULL, NULL}
 };
Index: varnish.stub.php
===================================================================
--- /dev/null
+++ pecl/varnish/trunk/varnish.stub.php	(copie de travail)
@@ -0,0 +1,59 @@
+<?php
+
+class VarnishAdmin {
+	public function __construct(array $opt = []);
+
+	public function connect(): bool;
+
+	public function auth(): bool;
+
+	public function getParams(): array;
+
+	public function setParam(string $name, string $value): int;
+
+	public function stop(): int;
+
+	public function start(): int;
+
+	public function banUrl(string $regex): int;
+
+	public function ban(string $regex): int;
+
+	public function isRunning(): bool;
+
+	public function getPanic(): string;
+
+	public function clearPanic(): int;
+
+	public function setHost(string $host): void;
+
+	public function setIdent(string $ident): void;
+
+	public function setSecret(string $secret): void;
+
+	public function setTimeout(int $timeout): void;
+
+	public function setPort(int $port): void;
+
+	public function setCompat(int $compat): void;
+
+	public function getVclList(): array;
+
+	public function vclUse(string $name): bool;
+
+	public function disconnect(): bool;
+}
+
+class VarnishStat {
+	public function __construct(array $opt = []);
+
+	public function getSnapshot(): array;
+}
+
+class VarnishLog {
+	public function __construct(array $opt = []);
+
+	public function getLine(): array;
+
+	public function getTagName(int $ind): string;
+}

Index: varnish_arginfo.h
===================================================================
--- /dev/null
+++ pecl/varnish/trunk/varnish_arginfo.h	(copie de travail)
@@ -0,0 +1,81 @@
+/* This is a generated file, edit the .stub.php file instead.
+ * Stub hash: 8f85af0f0ca3c73efcc24ed046662a4df80bf74f */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_VarnishAdmin___construct, 0, 0, 0)
+	ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, opt, IS_ARRAY, 0, "[]")
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_VarnishAdmin_connect, 0, 0, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_VarnishAdmin_auth arginfo_class_VarnishAdmin_connect
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_VarnishAdmin_getParams, 0, 0, IS_ARRAY, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_VarnishAdmin_setParam, 0, 2, IS_LONG, 0)
+	ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+	ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_VarnishAdmin_stop, 0, 0, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_VarnishAdmin_start arginfo_class_VarnishAdmin_stop
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_VarnishAdmin_banUrl, 0, 1, IS_LONG, 0)
+	ZEND_ARG_TYPE_INFO(0, regex, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_VarnishAdmin_ban arginfo_class_VarnishAdmin_banUrl
+
+#define arginfo_class_VarnishAdmin_isRunning arginfo_class_VarnishAdmin_connect
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_VarnishAdmin_getPanic, 0, 0, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_VarnishAdmin_clearPanic arginfo_class_VarnishAdmin_stop
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_VarnishAdmin_setHost, 0, 1, IS_VOID, 0)
+	ZEND_ARG_TYPE_INFO(0, host, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_VarnishAdmin_setIdent, 0, 1, IS_VOID, 0)
+	ZEND_ARG_TYPE_INFO(0, ident, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_VarnishAdmin_setSecret, 0, 1, IS_VOID, 0)
+	ZEND_ARG_TYPE_INFO(0, secret, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_VarnishAdmin_setTimeout, 0, 1, IS_VOID, 0)
+	ZEND_ARG_TYPE_INFO(0, timeout, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_VarnishAdmin_setPort, 0, 1, IS_VOID, 0)
+	ZEND_ARG_TYPE_INFO(0, port, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_VarnishAdmin_setCompat, 0, 1, IS_VOID, 0)
+	ZEND_ARG_TYPE_INFO(0, compat, IS_LONG, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_VarnishAdmin_getVclList arginfo_class_VarnishAdmin_getParams
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_VarnishAdmin_vclUse, 0, 1, _IS_BOOL, 0)
+	ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_VarnishAdmin_disconnect arginfo_class_VarnishAdmin_connect
+
+#define arginfo_class_VarnishStat___construct arginfo_class_VarnishAdmin___construct
+
+#define arginfo_class_VarnishStat_getSnapshot arginfo_class_VarnishAdmin_getParams
+
+#define arginfo_class_VarnishLog___construct arginfo_class_VarnishAdmin___construct
+
+#define arginfo_class_VarnishLog_getLine arginfo_class_VarnishAdmin_getParams
+
+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_VarnishLog_getTagName, 0, 1, IS_STRING, 0)
+	ZEND_ARG_TYPE_INFO(0, ind, IS_LONG, 0)
+ZEND_END_ARG_INFO()