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
|
From 1f22de74379208d9758ba99a9bd7373eefeb48f2 Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Mon, 28 Mar 2022 08:09:29 +0200
Subject: [PATCH 1/3] fix #513 skip test with old and dead libmemcached
---
tests/memcachedserver.phpt | 1 -
tests/memcachedserver6.phpt | 3 +++
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/tests/memcachedserver.phpt b/tests/memcachedserver.phpt
index 7b058d7..407fcf9 100644
--- a/tests/memcachedserver.phpt
+++ b/tests/memcachedserver.phpt
@@ -8,7 +8,6 @@ if (!extension_loaded("memcached")) {
if (!class_exists("MemcachedServer")) {
die("skip memcached not built with libmemcachedprotocol support\n");
}
-
if (Memcached::LIBMEMCACHED_VERSION_HEX < 0x1001000) {
die("skip needs at least libmemcached 1.1.0\n");
}
diff --git a/tests/memcachedserver6.phpt b/tests/memcachedserver6.phpt
index a2277b4..3d02b24 100644
--- a/tests/memcachedserver6.phpt
+++ b/tests/memcachedserver6.phpt
@@ -8,6 +8,9 @@ if (!extension_loaded("memcached")) {
if (!class_exists("MemcachedServer")) {
die("skip memcached not built with libmemcachedprotocol support\n");
}
+if (Memcached::LIBMEMCACHED_VERSION_HEX < 0x1001000) {
+ die("skip needs at least libmemcached 1.1.0\n");
+}
?>
--FILE--
<?php
--
2.35.3
From fc388e65e7ceab9e6d52bc77b6306f71db981873 Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Fri, 3 Jun 2022 16:56:00 +0200
Subject: [PATCH 2/3] fix ${var} deprecation
---
tests/touch_binary.phpt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/touch_binary.phpt b/tests/touch_binary.phpt
index 382c177..059ec74 100644
--- a/tests/touch_binary.phpt
+++ b/tests/touch_binary.phpt
@@ -28,12 +28,12 @@ function status_print ($op, $mem, $expected)
$code = $mem->getResultcode();
if ($code == $expected)
- echo "${op} status code as expected" . PHP_EOL;
+ echo "{$op} status code as expected" . PHP_EOL;
else {
$expected = resolve_to_constant ($expected);
$code = resolve_to_constant ($code);
- echo "${op} status code mismatch, expected ${expected} but got ${code}" . PHP_EOL;
+ echo "{$op} status code mismatch, expected {$expected} but got {$code}" . PHP_EOL;
}
}
--
2.35.3
From ce2dfa5e649e01e4b4df925ebaef95ca75a3f353 Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Thu, 28 Jul 2022 09:28:33 +0200
Subject: [PATCH 3/3] mark password as a sensitive param for 8.2 (#516)
* mark password as a sensitive param for 8.2
---
php_memcached.c | 7 +++----
php_memcached.stub.php | 6 +++---
php_memcached_arginfo.h | 37 +++++++++++++++++++++++++++++-----
php_memcached_legacy_arginfo.h | 30 ++++++++++++++++++++++-----
4 files changed, 63 insertions(+), 17 deletions(-)
diff --git a/php_memcached.c b/php_memcached.c
index 73deaf6..7ccc9b5 100644
--- a/php_memcached.c
+++ b/php_memcached.c
@@ -3898,6 +3898,7 @@ PHP_METHOD(MemcachedServer, on)
#if PHP_VERSION_ID < 80000
#include "php_memcached_legacy_arginfo.h"
#else
+#include "zend_attributes.h"
#include "php_memcached_arginfo.h"
#endif
@@ -4254,8 +4255,7 @@ PHP_MINIT_FUNCTION(memcached)
le_memc = zend_register_list_destructors_ex(NULL, php_memc_dtor, "Memcached persistent connection", module_number);
- INIT_CLASS_ENTRY(ce, "Memcached", class_Memcached_methods);
- memcached_ce = zend_register_internal_class(&ce);
+ memcached_ce = register_class_Memcached();
memcached_ce->create_object = php_memc_object_new;
#ifdef HAVE_MEMCACHED_PROTOCOL
@@ -4264,8 +4264,7 @@ PHP_MINIT_FUNCTION(memcached)
memcached_server_object_handlers.clone_obj = NULL;
memcached_server_object_handlers.free_obj = php_memc_server_free_storage;
- INIT_CLASS_ENTRY(ce, "MemcachedServer", class_MemcachedServer_methods);
- memcached_server_ce = zend_register_internal_class(&ce);
+ memcached_server_ce = register_class_MemcachedServer();
memcached_server_ce->create_object = php_memc_server_new;
#endif
diff --git a/php_memcached.stub.php b/php_memcached.stub.php
index 819186f..a44b180 100644
--- a/php_memcached.stub.php
+++ b/php_memcached.stub.php
@@ -3,9 +3,9 @@
/**
* @generate-function-entries
* @generate-legacy-arginfo
+ * @generate-class-entries
*/
-
class Memcached {
public function __construct(?string $persistent_id=null, ?callable $callback=null, ?string $connection_str=null) {}
@@ -75,7 +75,7 @@ class Memcached {
public function setOptions(array $options): bool {}
public function setBucket(array $host_map, ?array $forward_map, int $replicas): bool {}
#ifdef HAVE_MEMCACHED_SASL
- public function setSaslAuthData(string $username, string $password): bool {}
+ public function setSaslAuthData(string $username, #[\SensitiveParameter] string $password): bool {}
#endif
#ifdef HAVE_MEMCACHED_SET_ENCODING_KEY
@@ -86,7 +86,7 @@ class Memcached {
public function checkKey(string $key): bool {}
}
-#ifdef HAVE_MEMCACHED_PROTOCOL
+#if defined(HAVE_MEMCACHED_PROTOCOL)
class MemcachedServer {
public function run(string $address): bool {}
diff --git a/php_memcached_arginfo.h b/php_memcached_arginfo.h
index 3373624..3108e39 100644
--- a/php_memcached_arginfo.h
+++ b/php_memcached_arginfo.h
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
- * Stub hash: 3f4694d4e1f3d1647a832acd8539b056b2ab5e7a */
+ * Stub hash: 0964c9bfee903e59b63e5a16bd8b6611d827b151 */
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Memcached___construct, 0, 0, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, persistent_id, IS_STRING, 1, "null")
@@ -406,12 +406,39 @@ static const zend_function_entry class_Memcached_methods[] = {
};
-static const zend_function_entry class_MemcachedServer_methods[] = {
#if defined(HAVE_MEMCACHED_PROTOCOL)
+static const zend_function_entry class_MemcachedServer_methods[] = {
ZEND_ME(MemcachedServer, run, arginfo_class_MemcachedServer_run, ZEND_ACC_PUBLIC)
-#endif
-#if defined(HAVE_MEMCACHED_PROTOCOL)
ZEND_ME(MemcachedServer, on, arginfo_class_MemcachedServer_on, ZEND_ACC_PUBLIC)
-#endif
ZEND_FE_END
};
+#endif
+
+static zend_class_entry *register_class_Memcached(void)
+{
+ zend_class_entry ce, *class_entry;
+
+ INIT_CLASS_ENTRY(ce, "Memcached", class_Memcached_methods);
+ class_entry = zend_register_internal_class_ex(&ce, NULL);
+#if (PHP_VERSION_ID >= 80200)
+
+#if defined(HAVE_MEMCACHED_SASL)
+
+ zend_add_parameter_attribute(zend_hash_str_find_ptr(&class_entry->function_table, "setsaslauthdata", sizeof("setsaslauthdata") - 1), 1, ZSTR_KNOWN(ZEND_STR_SENSITIVEPARAMETER), 0);
+#endif
+#endif
+
+ return class_entry;
+}
+
+#if defined(HAVE_MEMCACHED_PROTOCOL)
+static zend_class_entry *register_class_MemcachedServer(void)
+{
+ zend_class_entry ce, *class_entry;
+
+ INIT_CLASS_ENTRY(ce, "MemcachedServer", class_MemcachedServer_methods);
+ class_entry = zend_register_internal_class_ex(&ce, NULL);
+
+ return class_entry;
+}
+#endif
diff --git a/php_memcached_legacy_arginfo.h b/php_memcached_legacy_arginfo.h
index ad6d656..6bb8e2d 100644
--- a/php_memcached_legacy_arginfo.h
+++ b/php_memcached_legacy_arginfo.h
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
- * Stub hash: 3f4694d4e1f3d1647a832acd8539b056b2ab5e7a */
+ * Stub hash: 0964c9bfee903e59b63e5a16bd8b6611d827b151 */
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Memcached___construct, 0, 0, 0)
ZEND_ARG_INFO(0, persistent_id)
@@ -402,12 +402,32 @@ static const zend_function_entry class_Memcached_methods[] = {
};
-static const zend_function_entry class_MemcachedServer_methods[] = {
#if defined(HAVE_MEMCACHED_PROTOCOL)
+static const zend_function_entry class_MemcachedServer_methods[] = {
ZEND_ME(MemcachedServer, run, arginfo_class_MemcachedServer_run, ZEND_ACC_PUBLIC)
-#endif
-#if defined(HAVE_MEMCACHED_PROTOCOL)
ZEND_ME(MemcachedServer, on, arginfo_class_MemcachedServer_on, ZEND_ACC_PUBLIC)
-#endif
ZEND_FE_END
};
+#endif
+
+static zend_class_entry *register_class_Memcached(void)
+{
+ zend_class_entry ce, *class_entry;
+
+ INIT_CLASS_ENTRY(ce, "Memcached", class_Memcached_methods);
+ class_entry = zend_register_internal_class_ex(&ce, NULL);
+
+ return class_entry;
+}
+
+#if defined(HAVE_MEMCACHED_PROTOCOL)
+static zend_class_entry *register_class_MemcachedServer(void)
+{
+ zend_class_entry ce, *class_entry;
+
+ INIT_CLASS_ENTRY(ce, "MemcachedServer", class_MemcachedServer_methods);
+ class_entry = zend_register_internal_class_ex(&ce, NULL);
+
+ return class_entry;
+}
+#endif
--
2.35.3
|