testing/php84-pecl-redis: upgrade to 6.1.0_rc1

This commit is contained in:
Andy Postnikov 2024-08-04 21:53:51 +00:00
parent e229d0183c
commit b8ad17265f
3 changed files with 3 additions and 124 deletions

View File

@ -2,7 +2,7 @@
# Maintainer: Andy Postnikov <apostnikov@gmail.com>
pkgname=php84-pecl-redis
_extname=redis
pkgver=6.0.2
pkgver=6.1.0_rc1
_pkgver=${pkgver/_rc/RC}
pkgrel=0
pkgdesc="PHP 8.4 extension for interfacing with Redis - PECL"
@ -13,8 +13,7 @@ _phpv=84
_php=php$_phpv
depends="$_php-pecl-igbinary $_php-pecl-msgpack $_php-session"
makedepends="$_php-dev lz4-dev zstd-dev"
source="php-pecl-$_extname-$_pkgver.tgz::https://pecl.php.net/get/$_extname-$_pkgver.tgz
fix-random1.patch fix-random2.patch"
source="php-pecl-$_extname-$_pkgver.tgz::https://pecl.php.net/get/$_extname-$_pkgver.tgz"
builddir="$srcdir/$_extname-$_pkgver"
provides="$_php-redis=$pkgver-r$pkgrel" # for backward compatibility
replaces="$_php-redis" # for backward compatibility
@ -46,7 +45,5 @@ package() {
}
sha512sums="
1918d15433d1b4d782a9fb0364f6dfeed8d9e6c2ae70c34e235be5f890992c73a40ef19842e0aabb181da86dd2cde28b9aebab8698b387738321298a2ab94aa6 php-pecl-redis-6.0.2.tgz
cef40fbda8a148c9a4a926877700ab60bc2f0e9f7ee560b23c91aaa717dbe62b4de7a717a6949bedd91ced5cbb736806027b86159ceb59a53d6d6542573962be fix-random1.patch
cee2cc7606312d0b48ec172918f06721df09641c599eecb791afe0deae815e14ceb45e986bde642de4b82eec61fb173b4a070aefd8416d50ca5c3bb7766fb012 fix-random2.patch
1e20abc5378ec57dedb8adadeb86c7f16208d795b7b9e5c92cd358baf83cd75b951ac906c9d72595e88f6e04ef634231d230826d8bd34609dddc53007861ce31 php-pecl-redis-6.1.0RC1.tgz
"

View File

@ -1,83 +0,0 @@
Patch-Source: https://github.com/phpredis/phpredis/commit/a51215ce2b22bcd1f506780c35b6833471e0b8cb
From a51215ce2b22bcd1f506780c35b6833471e0b8cb Mon Sep 17 00:00:00 2001
From: michael-grunder <michael.grunder@gmail.com>
Date: Mon, 18 Mar 2024 14:42:35 -0700
Subject: [PATCH] Update random includes.
PHP 8.4 has some breaking changes with respect to where PHP's random methods and
helpers are. This commit fixes those issues while staying backward compatible.
Fixes #2463
---
backoff.c | 12 ++++++------
library.c | 7 ++++++-
redis.c | 6 +++++-
3 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/backoff.c b/backoff.c
index d0961fcfaf..1be04a8fe8 100644
--- a/backoff.c
+++ b/backoff.c
@@ -1,14 +1,14 @@
#include "common.h"
+#if PHP_VERSION_ID < 80400
#include <ext/standard/php_rand.h>
-
-#if PHP_VERSION_ID >= 70100
-#include <ext/standard/php_mt_rand.h>
#else
+#include <ext/random/php_random.h>
+#endif
+
+#if PHP_VERSION_ID < 70100
static zend_long php_mt_rand_range(zend_long min, zend_long max) {
- zend_long number = php_rand();
- RAND_RANGE(number, min, max, PHP_RAND_MAX);
- return number;
+ return min + php_rand() % (max - min + 1)
}
#endif
diff --git a/library.c b/library.c
index 3d65c8529d..f81556a9ed 100644
--- a/library.c
+++ b/library.c
@@ -56,9 +56,14 @@
#include <ext/json/php_json.h>
#endif
-#include <ext/standard/php_rand.h>
#include <ext/hash/php_hash.h>
+#if PHP_VERSION_ID < 80400
+#include <ext/standard/php_rand.h>
+#else
+#include <ext/random/php_random.h>
+#endif
+
#define UNSERIALIZE_NONE 0
#define UNSERIALIZE_KEYS 1
#define UNSERIALIZE_VALS 2
diff --git a/redis.c b/redis.c
index ec6f65d2ed..2330bf7edf 100644
--- a/redis.c
+++ b/redis.c
@@ -27,12 +27,16 @@
#include "redis_cluster.h"
#include "redis_commands.h"
#include "redis_sentinel.h"
-#include <standard/php_random.h>
#include <ext/spl/spl_exceptions.h>
#include <zend_exceptions.h>
#include <ext/standard/info.h>
#include <ext/hash/php_hash.h>
+#if PHP_VERSION_ID < 80400
+#include <ext/standard/php_random.h>
+#else
+#include <ext/random/php_random.h>
+#endif
#ifdef PHP_SESSION
#include <ext/session/php_session.h>

View File

@ -1,35 +0,0 @@
Patch-Source: https://github.com/phpredis/phpredis/commit/c139de3abac1dd33b97ef0de5af41b6e3a78f7ab
From c139de3abac1dd33b97ef0de5af41b6e3a78f7ab Mon Sep 17 00:00:00 2001
From: michael-grunder <michael.grunder@gmail.com>
Date: Sat, 1 Jun 2024 13:09:30 -0700
Subject: [PATCH] We don't need to use a ranom value for our ECHO liveness
challenge.
A microsecond resolution timestamp combined with a monotonically
incremented counter should be sufficient.
This also fixes PHP 8.4 compilation as PHP 8.4 doesn't seem to have
`php_rand()`.
---
library.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/library.c b/library.c
index ce0cbda26..42a132c4c 100644
--- a/library.c
+++ b/library.c
@@ -2886,11 +2886,13 @@ redis_sock_create(char *host, int host_len, int port,
}
static int redis_uniqid(char *buf, size_t buflen) {
+ static unsigned long counter = 0;
struct timeval tv;
+
gettimeofday(&tv, NULL);
return snprintf(buf, buflen, "phpredis:%08lx%05lx:%08lx",
- (long)tv.tv_sec, (long)tv.tv_usec, (long)php_rand());
+ (long)tv.tv_sec, (long)tv.tv_usec, counter++);
}
static int redis_stream_liveness_check(php_stream *stream) {