Gentoo Archives: gentoo-commits

From: Brian Evans <grknight@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-php/pecl-memcache/, dev-php/pecl-memcache/files/
Date: Tue, 23 Nov 2021 15:18:53
Message-Id: 1637680727.fdbb79a442691183e3a57ef06c0dc0f430ecea3a.grknight@gentoo
1 commit: fdbb79a442691183e3a57ef06c0dc0f430ecea3a
2 Author: Brian Evans <grknight <AT> gentoo <DOT> org>
3 AuthorDate: Tue Nov 23 14:52:40 2021 +0000
4 Commit: Brian Evans <grknight <AT> gentoo <DOT> org>
5 CommitDate: Tue Nov 23 15:18:47 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fdbb79a4
7
8 dev-php/pecl-memcache: Revbump to support PHP 8.1
9
10 Signed-off-by: Brian Evans <grknight <AT> gentoo.org>
11
12 .../pecl-memcache/files/8.0-patches-20211123.patch | 204 +++++++++++++++++++++
13 .../pecl-memcache/pecl-memcache-4.0.5.2-r1.ebuild | 3 +-
14 ...0.5.2-r1.ebuild => pecl-memcache-8.0-r1.ebuild} | 21 ++-
15 3 files changed, 219 insertions(+), 9 deletions(-)
16
17 diff --git a/dev-php/pecl-memcache/files/8.0-patches-20211123.patch b/dev-php/pecl-memcache/files/8.0-patches-20211123.patch
18 new file mode 100644
19 index 000000000000..9005ac5feef3
20 --- /dev/null
21 +++ b/dev-php/pecl-memcache/files/8.0-patches-20211123.patch
22 @@ -0,0 +1,204 @@
23 +diff --git a/Dockerfile b/Dockerfile
24 +index a52759e..506c28a 100644
25 +--- a/Dockerfile
26 ++++ b/Dockerfile
27 +@@ -1,10 +1,13 @@
28 + ARG PHP_IMAGE=php:8.0
29 + FROM $PHP_IMAGE
30 +
31 ++RUN docker-php-ext-configure pcntl --enable-pcntl \
32 ++ && docker-php-ext-install -j$(nproc) pcntl
33 ++
34 + RUN apt-get update && apt-get install -y \
35 + git \
36 + zlib1g-dev \
37 +- memcached ;
38 ++ memcached ;
39 +
40 + COPY docker/host.conf /etc/host.conf
41 +
42 +diff --git a/README b/README
43 +index b36fa46..07f8f89 100644
44 +--- a/README
45 ++++ b/README
46 +@@ -3,7 +3,7 @@ This is an official repository for pecl-memcache plugin since 2019.
47 + This repository contains modified pecl-memcache plugin ported to PHP8,
48 + which was originally developed for the need of hosting company in Slovakia (Websupport.sk).
49 +
50 +-The latest release is 8.0 (released: 2020-12-06) with support for PHP 8.0.
51 ++The latest release is 8.0 (released: 2020-12-06) with support for PHP 8.0 and unofficial support for PHP 7.3 and 7.4
52 +
53 + Please use version 4.0.5.1 (released: 2020-12-19) for PHP 7.x from branch NON_BLOCKING_IO_php7.
54 +
55 +diff --git a/Vagrantfile b/Vagrantfile
56 +new file mode 100644
57 +index 0000000..8665890
58 +--- /dev/null
59 ++++ b/Vagrantfile
60 +@@ -0,0 +1,17 @@
61 ++# -*- mode: ruby -*-
62 ++# vi: set ft=ruby :
63 ++
64 ++VAGRANTFILE_API_VERSION = '2'
65 ++
66 ++Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
67 ++ config.vm.box = 'ubuntu/bionic64'
68 ++
69 ++ config.vm.provider :virtualbox do |vb|
70 ++ vb.name = 'ext-memcache-dev'
71 ++ vb.memory = 1024
72 ++ vb.cpus = 2
73 ++ end
74 ++
75 ++ config.vm.provision 'docker'
76 ++
77 ++end
78 +diff --git a/src/memcache.c b/src/memcache.c
79 +index 7c3a660..2cb675b 100644
80 +--- a/src/memcache.c
81 ++++ b/src/memcache.c
82 +@@ -924,7 +924,7 @@ static void php_mmc_store(INTERNAL_FUNCTION_PARAMETERS, int op) /* {{{ */
83 + continue;
84 + }
85 +
86 +- /* begin sending requests immediatly */
87 ++ /* begin sending requests immediately */
88 + mmc_pool_select(pool);
89 + } ZEND_HASH_FOREACH_END();
90 + }
91 +@@ -1089,7 +1089,7 @@ static void php_mmc_numeric(INTERNAL_FUNCTION_PARAMETERS, int deleted, int inver
92 + continue;
93 + }
94 +
95 +- /* begin sending requests immediatly */
96 ++ /* begin sending requests immediately */
97 + mmc_pool_select(pool);
98 + } ZEND_HASH_FOREACH_END();
99 +
100 +@@ -1319,8 +1319,9 @@ static void php_mmc_connect(INTERNAL_FUNCTION_PARAMETERS, zend_bool persistent)
101 + size_t host_len;
102 + zend_long tcp_port = MEMCACHE_G(default_port);
103 + double timeout = MMC_DEFAULT_TIMEOUT;
104 ++ zend_bool null_port;
105 +
106 +- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|ld", &host, &host_len, &tcp_port, &timeout) == FAILURE) {
107 ++ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|l!d", &host, &host_len, &tcp_port, &null_port, &timeout) == FAILURE) {
108 + return;
109 + }
110 +
111 +@@ -2492,7 +2493,7 @@ PHP_FUNCTION(memcache_flush)
112 + pool->protocol->flush(request, delay);
113 +
114 + if (mmc_pool_schedule(pool, pool->servers[i], request) == MMC_OK) {
115 +- /* begin sending requests immediatly */
116 ++ /* begin sending requests immediately */
117 + mmc_pool_select(pool);
118 + }
119 + }
120 +diff --git a/src/memcache_pool.c b/src/memcache_pool.c
121 +index 733a0c5..e52389d 100644
122 +--- a/src/memcache_pool.c
123 ++++ b/src/memcache_pool.c
124 +@@ -1303,7 +1303,7 @@ int mmc_pool_schedule_get(
125 + pool->protocol->end_get(mmc->buildreq);
126 + mmc_pool_schedule(pool, mmc, mmc->buildreq);
127 +
128 +- /* begin sending requests immediatly */
129 ++ /* begin sending requests immediately */
130 + mmc_pool_select(pool);
131 +
132 + mmc->buildreq = mmc_pool_request_get(
133 +diff --git a/src/memcache_session.c b/src/memcache_session.c
134 +index e4a80de..d3aab24 100644
135 +--- a/src/memcache_session.c
136 ++++ b/src/memcache_session.c
137 +@@ -319,7 +319,7 @@ PS_READ_FUNC(memcache)
138 + ZVAL_NULL(&addresult);
139 +
140 + /* third request fetches the data, data is only valid if either of the lock requests succeeded */
141 +- ZVAL_EMPTY_STRING(&dataresult);
142 ++ ZVAL_NULL(&dataresult);
143 +
144 + /* create requests */
145 + if (php_mmc_session_read_request(pool, &zkey, lockparam, &addresult, dataparam, &lockrequest, &addrequest, &datarequest) != MMC_OK) {
146 +diff --git a/tests/redundancy_test.phpt b/tests/redundancy_test.phpt
147 +new file mode 100644
148 +index 0000000..fb5ab84
149 +--- /dev/null
150 ++++ b/tests/redundancy_test.phpt
151 +@@ -0,0 +1,75 @@
152 ++--TEST--
153 ++redundancy test
154 ++--SKIPIF--
155 ++<?php include 'connect.inc'; if (!MEMCACHE_HAVE_SESSION) print 'skip not compiled with session support'; else if (!function_exists('pcntl_fork')) print 'skip not compiled with pcntl_fork() support'; ?>
156 ++--FILE--
157 ++<?php
158 ++
159 ++include 'connect.inc';
160 ++
161 ++$sid = md5(rand());
162 ++
163 ++ini_set('session.save_handler', 'memcache');
164 ++ini_set('memcache.session_save_path', "tcp://$host:$port,tcp://$host2:$port2");
165 ++ini_set('memcache.session_redundancy', 3);
166 ++
167 ++$memcache1 = test_connect1();
168 ++$memcache2 = test_connect2();
169 ++
170 ++$pid = pcntl_fork();
171 ++if (!$pid) {
172 ++ // In child process
173 ++ session_id($sid);
174 ++ session_start();
175 ++ if (!isset($_SESSION['counter']))
176 ++ $_SESSION['counter'] = 0;
177 ++ $_SESSION['counter'] += 1;
178 ++ session_write_close();
179 ++
180 ++ exit(0);
181 ++}
182 ++pcntl_waitpid($pid, $status);
183 ++
184 ++$memcache1->flush();
185 ++
186 ++$pid = pcntl_fork();
187 ++if (!$pid) {
188 ++ // In child process
189 ++ session_id($sid);
190 ++ session_start();
191 ++ if (!isset($_SESSION['counter']))
192 ++ $_SESSION['counter'] = 0;
193 ++ $_SESSION['counter'] += 1;
194 ++ session_write_close();
195 ++
196 ++ exit(0);
197 ++}
198 ++pcntl_waitpid($pid, $status);
199 ++
200 ++$memcache2->flush();
201 ++
202 ++$pid = pcntl_fork();
203 ++if (!$pid) {
204 ++ // In child process
205 ++ session_id($sid);
206 ++ session_start();
207 ++ if (!isset($_SESSION['counter']))
208 ++ $_SESSION['counter'] = 0;
209 ++ $_SESSION['counter'] += 1;
210 ++ session_write_close();
211 ++
212 ++ exit(0);
213 ++}
214 ++pcntl_waitpid($pid, $status);
215 ++
216 ++
217 ++session_id($sid);
218 ++session_start();
219 ++var_dump($_SESSION);
220 ++
221 ++?>
222 ++--EXPECT--
223 ++array(1) {
224 ++ ["counter"]=>
225 ++ int(3)
226 ++}
227
228 diff --git a/dev-php/pecl-memcache/pecl-memcache-4.0.5.2-r1.ebuild b/dev-php/pecl-memcache/pecl-memcache-4.0.5.2-r1.ebuild
229 index 10134a07db4d..240a4d9d5754 100644
230 --- a/dev-php/pecl-memcache/pecl-memcache-4.0.5.2-r1.ebuild
231 +++ b/dev-php/pecl-memcache/pecl-memcache-4.0.5.2-r1.ebuild
232 @@ -9,7 +9,7 @@ PHP_EXT_NEEDED_USE="session(-)?"
233 DOCS=( README example.php )
234 HTML_DOCS=( memcache.php )
235
236 -USE_PHP="php7-3 php7-4 php8-0"
237 +USE_PHP="php7-3 php7-4 php8-0 php8-1"
238
239 inherit php-ext-pecl-r3
240
241 @@ -25,6 +25,7 @@ IUSE="+session"
242 DEPEND="php_targets_php7-3? ( sys-libs/zlib ) php_targets_php7-4? ( sys-libs/zlib )"
243 RDEPEND="${DEPEND}
244 php_targets_php8-0? ( dev-php/pecl-memcache:8[php_targets_php8-0(-)?] )
245 + php_targets_php8-1? ( dev-php/pecl-memcache:8[php_targets_php8-1(-)?] )
246 "
247
248 # The test suite requires memcached to be running.
249
250 diff --git a/dev-php/pecl-memcache/pecl-memcache-4.0.5.2-r1.ebuild b/dev-php/pecl-memcache/pecl-memcache-8.0-r1.ebuild
251 similarity index 72%
252 copy from dev-php/pecl-memcache/pecl-memcache-4.0.5.2-r1.ebuild
253 copy to dev-php/pecl-memcache/pecl-memcache-8.0-r1.ebuild
254 index 10134a07db4d..ec0fa315424c 100644
255 --- a/dev-php/pecl-memcache/pecl-memcache-4.0.5.2-r1.ebuild
256 +++ b/dev-php/pecl-memcache/pecl-memcache-8.0-r1.ebuild
257 @@ -9,29 +9,34 @@ PHP_EXT_NEEDED_USE="session(-)?"
258 DOCS=( README example.php )
259 HTML_DOCS=( memcache.php )
260
261 -USE_PHP="php7-3 php7-4 php8-0"
262 +USE_PHP="php7-3 php7-4 php8-0 php8-1"
263
264 inherit php-ext-pecl-r3
265
266 -USE_PHP="php7-3 php7-4"
267 +USE_PHP="php8-0 php8-1"
268
269 KEYWORDS="~amd64 ~hppa ~ppc64 ~x86"
270
271 DESCRIPTION="PHP extension for using memcached"
272 LICENSE="PHP-3"
273 -SLOT="7"
274 +SLOT="8"
275 IUSE="+session"
276
277 -DEPEND="php_targets_php7-3? ( sys-libs/zlib ) php_targets_php7-4? ( sys-libs/zlib )"
278 +DEPEND="
279 + php_targets_php8-0? ( sys-libs/zlib )
280 + php_targets_php8-1? ( sys-libs/zlib )
281 +"
282 RDEPEND="${DEPEND}
283 - php_targets_php8-0? ( dev-php/pecl-memcache:8[php_targets_php8-0(-)?] )
284 + php_targets_php7-3? ( dev-php/pecl-memcache:7[php_targets_php7-3(-)?] )
285 + php_targets_php7-4? ( dev-php/pecl-memcache:7[php_targets_php7-4(-)?] )
286 "
287
288 # The test suite requires memcached to be running.
289 RESTRICT='test'
290 +PATCHES=( "${FILESDIR}/8.0-patches-20211123.patch" )
291
292 src_prepare() {
293 - if use php_targets_php7-3 || use php_targets_php7-4 ; then
294 + if use php_targets_php8-0 || use php_targets_php8-1 ; then
295 php-ext-source-r3_src_prepare
296 else
297 default
298 @@ -39,14 +44,14 @@ src_prepare() {
299 }
300
301 src_configure() {
302 - if use php_targets_php7-3 || use php_targets_php7-4 ; then
303 + if use php_targets_php8-0 || use php_targets_php8-1 ; then
304 local PHP_EXT_ECONF_ARGS=( --enable-memcache --with-zlib-dir="${EPREFIX}/usr" $(use_enable session memcache-session) )
305 php-ext-source-r3_src_configure
306 fi
307 }
308
309 src_install() {
310 - if use php_targets_php7-3 || use php_targets_php7-4 ; then
311 + if use php_targets_php8-0 || use php_targets_php8-1 ; then
312 php-ext-pecl-r3_src_install
313
314 php-ext-source-r3_addtoinifiles "memcache.allow_failover" "true"