git: 13e83b088b6d - main - databases/pecl-redis: Unbreak for php84

From: Muhammad Moinur Rahman <bofh_at_FreeBSD.org>
Date: Sat, 03 Aug 2024 17:58:56 UTC
The branch main has been updated by bofh:

URL: https://cgit.FreeBSD.org/ports/commit/?id=13e83b088b6d0c288a82e7acdbf41aa83b9be27c

commit 13e83b088b6d0c288a82e7acdbf41aa83b9be27c
Author:     Muhammad Moinur Rahman <bofh@FreeBSD.org>
AuthorDate: 2024-08-03 17:54:29 +0000
Commit:     Muhammad Moinur Rahman <bofh@FreeBSD.org>
CommitDate: 2024-08-03 17:55:44 +0000

    databases/pecl-redis: Unbreak for php84
    
    Approved by:    portmgr (blanket)
---
 databases/pecl-redis/Makefile              |  1 -
 databases/pecl-redis/files/patch-backoff.c | 20 ++++++++++++++++++++
 databases/pecl-redis/files/patch-library.c | 14 ++++++++++++++
 databases/pecl-redis/files/patch-redis.c   | 14 +++++++++++++-
 4 files changed, 47 insertions(+), 2 deletions(-)

diff --git a/databases/pecl-redis/Makefile b/databases/pecl-redis/Makefile
index 415f007e722a..57d9a2dba39e 100644
--- a/databases/pecl-redis/Makefile
+++ b/databases/pecl-redis/Makefile
@@ -12,7 +12,6 @@ LICENSE_FILE=	${WRKSRC}/COPYING
 
 USES=		php:build,pecl
 USE_PHP=	session:build
-IGNORE_WITH_PHP=	84
 
 OPTIONS_DEFINE=	IGBINARY
 IGBINARY_DESC=	Build with Igbinary serializer
diff --git a/databases/pecl-redis/files/patch-backoff.c b/databases/pecl-redis/files/patch-backoff.c
new file mode 100644
index 000000000000..4534ef9c8013
--- /dev/null
+++ b/databases/pecl-redis/files/patch-backoff.c
@@ -0,0 +1,20 @@
+--- backoff.c.orig	2024-08-03 17:49:28 UTC
++++ backoff.c
+@@ -1,9 +1,17 @@
+ #include "common.h"
+ 
++#if PHP_VERSION_ID <= 80300
+ #include <ext/standard/php_rand.h>
++#else
++#include <ext/random/php_random.h>
++#endif
+ 
+ #if PHP_VERSION_ID >= 70100
++#if PHP_VERSION_ID <= 80300
+ #include <ext/standard/php_mt_rand.h>
++#else
++#include <ext/random/php_random.h>
++#endif
+ #else
+ static zend_long php_mt_rand_range(zend_long min, zend_long max) {
+     zend_long number = php_rand();
diff --git a/databases/pecl-redis/files/patch-library.c b/databases/pecl-redis/files/patch-library.c
new file mode 100644
index 000000000000..df1d2d13fe76
--- /dev/null
+++ b/databases/pecl-redis/files/patch-library.c
@@ -0,0 +1,14 @@
+--- library.c.orig	2024-08-03 17:50:52 UTC
++++ library.c
+@@ -56,7 +56,11 @@
+ #include <ext/json/php_json.h>
+ #endif
+ 
++#if PHP_VERSION_ID <= 80300
+ #include <ext/standard/php_rand.h>
++#else
++#include <ext/random/php_random.h>
++#endif
+ #include <ext/hash/php_hash.h>
+ 
+ #define UNSERIALIZE_NONE 0
diff --git a/databases/pecl-redis/files/patch-redis.c b/databases/pecl-redis/files/patch-redis.c
index 68a2dc1488f4..3678e522cf9a 100644
--- a/databases/pecl-redis/files/patch-redis.c
+++ b/databases/pecl-redis/files/patch-redis.c
@@ -1,6 +1,18 @@
 --- redis.c.orig	2022-02-15 18:25:22 UTC
 +++ redis.c
-@@ -154,6 +154,9 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_pconnect, 0, 0, 1)
+@@ -27,7 +27,11 @@
+ #include "redis_cluster.h"
+ #include "redis_commands.h"
+ #include "redis_sentinel.h"
++#if PHP_VERSION_ID <= 80300
+ #include <standard/php_random.h>
++#else
++#include <ext/random/php_random.h>
++#endif
+ #include <zend_exceptions.h>
+ #include <ext/standard/info.h>
+ #include <ext/hash/php_hash.h>
+@@ -154,6 +158,9 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_pconnect, 0, 0, 1)
      ZEND_ARG_INFO(0, host)
      ZEND_ARG_INFO(0, port)
      ZEND_ARG_INFO(0, timeout)