Compare commits

...

No commits in common. "c10s" and "stream-php-8.4-rhel-9.9.0" have entirely different histories.

4 changed files with 195 additions and 37 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
/redis-6.1.0.tgz
/redis-6.2.0.tgz

View File

@ -3,16 +3,14 @@
#
# remirepo spec file for php-pecl-redis6
#
# Copyright (c) 2012-2024 Remi Collet
# License: CC-BY-SA-4.0
# http://creativecommons.org/licenses/by-sa/4.0/
# SPDX-FileCopyrightText: Copyright 2012-2025 Remi Collet
# SPDX-License-Identifier: CECILL-2.1
# http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
#
# Please, preserve the changelog entries
#
# For EL-9
%{!?__phpize: %global __phpize %{_bindir}/phpize}
%{!?__phpconfig: %global __phpconfig %{_bindir}/php-config}
%global php_base php
%bcond_without tests
%if 0%{?fedora}
@ -26,40 +24,39 @@
%bcond_with msgpack
%bcond_with liblzf
%endif
%if 0%{?fedora} >= 41 || 0%{?rhel} >= 10
%bcond_without valkey
%else
%bcond_with valkey
%endif
%global pie_vend phpredis
%global pie_proj phpredis
%global pecl_name redis
# after 20-json, 40-igbinary and 40-msgpack
# after 40-igbinary and 40-msgpack
%global ini_name 50-%{pecl_name}.ini
%global upstream_version 6.1.0
%global upstream_version 6.2.0
#global upstream_prever RC2
%global sources %{pecl_name}-%{upstream_version}%{?upstream_prever}
Summary: PHP extension for interfacing with key-value stores
Name: php-pecl-redis6
Name: %{php_base}-pecl-redis6
Version: %{upstream_version}%{?upstream_prever:~%{upstream_prever}}
Release: 2%{?dist}
Release: 3%{?dist}
License: PHP-3.01
URL: https://pecl.php.net/package/redis
Source0: https://pecl.php.net/get/%{sources}.tgz
Patch0: redis-8.0.patch
ExcludeArch: %{ix86}
BuildRequires: make
BuildRequires: gcc
BuildRequires: php-devel >= 7.4
BuildRequires: %{php_base}-devel >= 8.0
BuildRequires: php-pear
BuildRequires: php-json
%if %{with igbinary}
BuildRequires: php-pecl-igbinary-devel
BuildRequires: %{php_base}-pecl-igbinary-devel
%endif
%if %{with msgpack}
BuildRequires: php-pecl-msgpack-devel >= 2.0.3
BuildRequires: %{php_base}-pecl-msgpack-devel >= 2.0.3
%endif
%if %{with liblzf}
BuildRequires: pkgconfig(liblzf)
@ -77,21 +74,46 @@ BuildRequires: redis
Requires: php(zend-abi) = %{php_zend_api}
Requires: php(api) = %{php_core_api}
Requires: php-json%{?_isa}
%if %{with igbinary}
Requires: php-igbinary%{?_isa}
Requires: %{php_base}-pecl-igbinary%{?_isa}
%endif
%if %{with msgpack}
Requires: php-msgpack%{?_isa}
Requires: %{php_base}-pecl-msgpack%{?_isa}
%endif
Provides: php-%{pecl_name} = %{version}
Provides: php-%{pecl_name}%{?_isa} = %{version}
Provides: php-pecl(%{pecl_name}) = %{version}
Provides: php-pecl(%{pecl_name})%{?_isa} = %{version}
Provides: php-%{pecl_name} = %{version}
Provides: php-%{pecl_name}%{?_isa} = %{version}
Provides: php-pecl(%{pecl_name}) = %{version}
Provides: php-pecl(%{pecl_name})%{?_isa} = %{version}
Provides: php-pie(%{pie_vend}/%{pie_proj}) = %{version}
Provides: php-%{pie_vend}-%{pie_proj} = %{version}
%if "%{php_base}" != "php"
Requires: %{php_base}-common%{?_isa}
Conflicts: php-pecl-%{pecl_name}6
Provides: php-pecl-%{pecl_name}6 = %{version}-%{release}
Provides: php-pecl-%{pecl_name}6%{?_isa} = %{version}-%{release}
Provides: php-pecl-%{pecl_name} = %{version}-%{release}
Provides: php-pecl-%{pecl_name}%{?_isa} = %{version}-%{release}
%elif 0%{?fedora} >= 42 || 0%{?rhel} >= 10 || "%{php_version}" > "8.4"
Obsoletes: php-pecl-%{pecl_name} < 6
Provides: php-pecl-%{pecl_name} = %{version}-%{release}
Provides: php-pecl-%{pecl_name}%{?_isa} = %{version}-%{release}
Obsoletes: php-pecl-%{pecl_name}4 < 6
Provides: php-pecl-%{pecl_name}4 = %{version}-%{release}
Provides: php-pecl-%{pecl_name}4%{?_isa} = %{version}-%{release}
Obsoletes: php-pecl-%{pecl_name}5 < 6
Provides: php-pecl-%{pecl_name}5 = %{version}-%{release}
Provides: php-pecl-%{pecl_name}5%{?_isa} = %{version}-%{release}
%else
# A single version can be installed
Conflicts: php-pecl-%{pecl_name} < 6
Conflicts: php-pecl-%{pecl_name}4 < 6
Conflicts: php-pecl-%{pecl_name}5 < 6
%endif
%description
This extension provides an API for communicating with RESP-based key-value
@ -112,6 +134,7 @@ sed -e 's/role="test"/role="src"/' \
-i package.xml
cd %{sources}
%patch -P0 -p1
# Use system library
rm -r liblzf
@ -228,7 +251,7 @@ done
%check
# simple module load test
DEPS="--no-php-ini"
for i in json igbinary msgpack
for i in igbinary msgpack
do [ -f %{php_extdir}/${i}.so ] && DEPS="$DEPS --define extension=${i}.so"
done
@ -293,20 +316,32 @@ exit $ret
%changelog
* Wed Nov 20 2024 Remi Collet <rcollet@redhat.com> - 6.1.0-2
* Tue Oct 28 2025 Remi Collet <rcollet@redhat.com> - 6.2.0-3
- fix dependencies
- add patch for redis 8
* Thu Sep 11 2025 Remi Collet <rcollet@redhat.com> - 6.2.0-2
- build for php8.4
* Fri Jul 25 2025 Fedora Release Engineering <releng@fedoraproject.org> - 6.2.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild
* Tue Mar 25 2025 Remi Collet <remi@remirepo.net> - 6.2.0-1
- update to 6.2.0
- re-license spec file to CECILL-2.1
- add virtual provides for pie
* Sat Jan 18 2025 Fedora Release Engineering <releng@fedoraproject.org> - 6.1.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild
* Wed Nov 20 2024 Remi Collet <rcollet@redhat.com> - 6.1.0-3
- ignore 1 ONLINE test
* Tue Nov 19 2024 Remi Collet <rcollet@redhat.com> - 6.1.0-1
- RHEL build
* Mon Oct 14 2024 Remi Collet <remi@fedoraproject.org> - 6.1.0-2
- rebuild for https://fedoraproject.org/wiki/Changes/php84
* Sat Oct 5 2024 Remi Collet <remi@remirepo.net> - 6.1.0-1
* Mon Oct 7 2024 Remi Collet <remi@remirepo.net> - 6.1.0-1
- update to 6.1.0
- drop patch merged upstream
* Tue Sep 24 2024 Remi Collet <remi@remirepo.net> - 6.1.0~RC2-1
- update to 6.1.0RC2
- fix test suite with redis 6.2 using patch from
https://github.com/phpredis/phpredis/pull/2555
* Mon Sep 16 2024 Remi Collet <remi@remirepo.net> - 6.0.2-3
- cleanup and modernize spec file

122
redis-8.0.patch Normal file
View File

@ -0,0 +1,122 @@
From 593ba012ac49065343f6bbf10adca5047414ce85 Mon Sep 17 00:00:00 2001
From: michael-grunder <michael.grunder@gmail.com>
Date: Sun, 4 May 2025 10:20:01 -0700
Subject: [PATCH] Check for `dragonfly_version` in `HELLO` response
DragonflyDB will report to be Redis but also include `dragonfly_version`
in the hello response, which we can use to identify the fork.
Also fix parsing of the `HELLO` response for `serverName()` and
`serverVersion()`. Starting in Redis 8.0 there seem to always be modules
running, which the previous function was not expecting or parsing.
---
library.c | 39 ++++++++++++++++++++++++++-------------
redis.c | 2 +-
tests/RedisTest.php | 2 ++
3 files changed, 29 insertions(+), 14 deletions(-)
diff --git a/library.c b/library.c
index a9fb523e48..ce3e2672d0 100644
--- a/library.c
+++ b/library.c
@@ -2018,26 +2018,31 @@ static int
redis_hello_response(INTERNAL_FUNCTION_PARAMETERS,
RedisSock *redis_sock, zval *z_tab, void *ctx)
{
- int numElems;
zval z_ret, *zv;
+ int numElems;
- if (read_mbulk_header(redis_sock, &numElems) < 0) {
- if (IS_ATOMIC(redis_sock)) {
- RETVAL_FALSE;
- } else {
- add_next_index_bool(z_tab, 0);
- }
- return FAILURE;
- }
+ if (read_mbulk_header(redis_sock, &numElems) < 0)
+ goto fail;
array_init(&z_ret);
- redis_mbulk_reply_zipped_raw_variant(redis_sock, &z_ret, numElems);
+
+ if (redis_read_multibulk_recursive(redis_sock, numElems, 0, &z_ret) != SUCCESS ||
+ array_zip_values_recursive(&z_ret) != SUCCESS)
+ {
+ zval_dtor(&z_ret);
+ goto fail;
+ }
if (redis_sock->hello.server) {
zend_string_release(redis_sock->hello.server);
}
- zv = zend_hash_str_find(Z_ARRVAL(z_ret), ZEND_STRL("server"));
- redis_sock->hello.server = zv ? zval_get_string(zv) : ZSTR_EMPTY_ALLOC();
+
+ if ((zv = zend_hash_str_find(Z_ARRVAL(z_ret), ZEND_STRL("dragonfly_version")))) {
+ redis_sock->hello.server = zend_string_init(ZEND_STRL("dragonfly"), 0);
+ } else {
+ zv = zend_hash_str_find(Z_ARRVAL(z_ret), ZEND_STRL("server"));
+ redis_sock->hello.server = zv ? zval_get_string(zv) : ZSTR_EMPTY_ALLOC();
+ }
if (redis_sock->hello.version) {
zend_string_release(redis_sock->hello.version);
@@ -2063,6 +2068,14 @@ redis_hello_response(INTERNAL_FUNCTION_PARAMETERS,
}
return SUCCESS;
+
+fail:
+ if (IS_ATOMIC(redis_sock)) {
+ RETVAL_FALSE;
+ } else {
+ add_next_index_bool(z_tab, 0);
+ }
+ return FAILURE;
}
@@ -4302,7 +4315,7 @@ redis_read_multibulk_recursive(RedisSock *redis_sock, long long elements, int st
elements--;
}
- return 0;
+ return SUCCESS;
}
static int
diff --git a/redis.c b/redis.c
index 3f13a59888..629dd5c20b 100644
--- a/redis.c
+++ b/redis.c
@@ -2131,7 +2131,7 @@ redis_sock_read_multibulk_multi_reply_loop(INTERNAL_FUNCTION_PARAMETERS,
int num = atol(inbuf + 1);
- if (num > 0 && redis_read_multibulk_recursive(redis_sock, num, 0, &z_ret) < 0) {
+ if (num > 0 && redis_read_multibulk_recursive(redis_sock, num, 0, &z_ret) != SUCCESS) {
return FAILURE;
}
}
diff --git a/tests/RedisTest.php b/tests/RedisTest.php
index e7854da442..1ebcc61e51 100644
--- a/tests/RedisTest.php
+++ b/tests/RedisTest.php
@@ -2476,6 +2476,7 @@ public function testServerInfo() {
$this->markTestSkipped();
$hello = $this->execHello();
+
if ( ! $this->assertArrayKey($hello, 'server') ||
! $this->assertArrayKey($hello, 'version'))
{
@@ -2486,6 +2487,7 @@ public function testServerInfo() {
$this->assertEquals($hello['version'], $this->redis->serverVersion());
$info = $this->redis->info();
+
$cmd1 = $info['total_commands_processed'];
/* Shouldn't hit the server */

View File

@ -1 +1 @@
SHA512 (redis-6.1.0.tgz) = 731697b429f8070ae33f02b6a302904c6e8e79c8d6fd3d07b9fcdb50f55b52448292a936ca4050406d14b6db11669269a315c798ce52a80e4857427a65b01dff
SHA512 (redis-6.2.0.tgz) = fd4d79cd4f7a3d25c865ae52daea4e6d9e805f55c3b7004633ac23ed6724a30b85ed3034bddee86c42146b39215309cb9c96f5659b248e6b859295cdf10e02f1