git: 8ea18beb7250 - main - net/pecl-radius: Fix build with php84 (8.4.0beta4+)

From: Po-Chuan Hsieh <sunpoet_at_FreeBSD.org>
Date: Thu, 05 Sep 2024 06:20:29 UTC
The branch main has been updated by sunpoet:

URL: https://cgit.FreeBSD.org/ports/commit/?id=8ea18beb725038e8eabd7fbdd73aed7c34ffbfd5

commit 8ea18beb725038e8eabd7fbdd73aed7c34ffbfd5
Author:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
AuthorDate: 2024-09-05 05:25:56 +0000
Commit:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
CommitDate: 2024-09-05 06:17:53 +0000

    net/pecl-radius: Fix build with php84 (8.4.0beta4+)
    
    Reference:      https://github.com/php/php-src/commit/8cf8751533aa37479f8f2e229e407e9bf6025237
                    https://github.com/php/php-src/commit/3e05c86c35e23d97a29f3f1ba0070df73fdf914f
                    https://pkg-status.freebsd.org/beefy16/data/133amd64-default/94b089c7ad30/logs/php84-pecl-radius-1.4.0b1_2.log
                    https://pkg-status.freebsd.org/beefy22/data/140amd64-default/94b089c7ad30/logs/php84-pecl-radius-1.4.0b1_2.log
                    https://pkg-status.freebsd.org/beefy18/data/main-amd64-default/p94b089c7ad30_sb162fc3f309/logs/php84-pecl-radius-1.4.0b1_2.log
---
 net/pecl-radius/files/patch-php84 | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/net/pecl-radius/files/patch-php84 b/net/pecl-radius/files/patch-php84
index c9aaa61bc046..4fcd64570cbd 100644
--- a/net/pecl-radius/files/patch-php84
+++ b/net/pecl-radius/files/patch-php84
@@ -1,3 +1,41 @@
+--- radlib.c.orig	2016-02-15 15:11:50 UTC
++++ radlib.c
+@@ -582,7 +582,7 @@ rad_create_request(struct rad_handle *h, int code)
+ 	/* Create a random authenticator */
+ 	for (i = 0;  i < LEN_AUTH;  i += 2) {
+ 		long r;
+-		r = php_rand();
++		r = (zend_long) php_mt_rand();
+ 		h->request[POS_AUTH+i] = (unsigned char) r;
+ 		h->request[POS_AUTH+i+1] = (unsigned char) (r >> 8);
+ 	}
+@@ -753,7 +753,7 @@ rad_auth_open(void)
+ 		php_srand(time(NULL) * getpid() * (unsigned long) (php_combined_lcg(TSRMLS_C) * 10000.0) TSRMLS_CC);
+ 		h->fd = -1;
+ 		h->num_servers = 0;
+-		h->ident = php_rand();
++		h->ident = (zend_long) php_mt_rand();
+ 		h->errmsg[0] = '\0';
+ 		memset(h->request, 0, sizeof h->request);
+ 		h->req_len = 0;
+@@ -1239,7 +1239,7 @@ int rad_salt_value(struct rad_handle *h, const char *i
+ 	const char *in_pos;
+ 	MD5_CTX md5;
+ 	char *out_pos;
+-	php_uint32 random;
++	uint32_t random;
+ 	size_t salted_len;
+ 	const char *secret;
+ 	TSRMLS_FETCH();
+@@ -1289,7 +1289,7 @@ int rad_salt_value(struct rad_handle *h, const char *i
+ 	}
+ 
+ 	/* Generate a random number to use as the salt. */
+-	random = php_rand();
++	random = (zend_long) php_mt_rand();
+ 
+ 	/* The RFC requires that the high bit of the salt be 1. Otherwise,
+ 	 * let's set up the header. */
 --- radlib_compat.h.orig	2016-02-15 15:11:50 UTC
 +++ radlib_compat.h
 @@ -39,7 +39,11 @@ any other GPL-like (LGPL, GPL2) License.