git: 4ea81886d1ce - main - www/pecl-yar: Fix build with PHP 8.2+

From: Po-Chuan Hsieh <sunpoet_at_FreeBSD.org>
Date: Fri, 30 Jun 2023 07:18:43 UTC
The branch main has been updated by sunpoet:

URL: https://cgit.FreeBSD.org/ports/commit/?id=4ea81886d1cea72cf529dcc81b5315de2f4ff35e

commit 4ea81886d1cea72cf529dcc81b5315de2f4ff35e
Author:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
AuthorDate: 2023-06-30 07:02:58 +0000
Commit:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
CommitDate: 2023-06-30 07:02:58 +0000

    www/pecl-yar: Fix build with PHP 8.2+
    
    - Update WWW
    
    Obtained from:  https://github.com/laruence/yar/pull/177
---
 www/pecl-yar/Makefile          |  5 ++---
 www/pecl-yar/files/patch-php82 | 47 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 49 insertions(+), 3 deletions(-)

diff --git a/www/pecl-yar/Makefile b/www/pecl-yar/Makefile
index e0d56d02d729..c7462d0d80dd 100644
--- a/www/pecl-yar/Makefile
+++ b/www/pecl-yar/Makefile
@@ -4,7 +4,8 @@ CATEGORIES=	www
 
 MAINTAINER=	sunpoet@FreeBSD.org
 COMMENT=	Yar (Yet another RPC framework) is a light, concurrent RPC framework
-WWW=		https://pecl.php.net/package/yar
+WWW=		https://pecl.php.net/package/yar \
+		https://github.com/laruence/yar
 
 LICENSE=	PHP301
 LICENSE_FILE=	${WRKSRC}/LICENSE
@@ -14,8 +15,6 @@ LIB_DEPENDS=	libcurl.so:ftp/curl
 USES=		localbase:ldflags php:build,pecl
 USE_PHP=	curl
 
-IGNORE_WITH_PHP=82 83
-
 OPTIONS_DEFINE=	MSGPACK
 OPTIONS_DEFAULT=MSGPACK
 MSGPACK_DESC=	Enable MSGPACK module
diff --git a/www/pecl-yar/files/patch-php82 b/www/pecl-yar/files/patch-php82
new file mode 100644
index 000000000000..636894041167
--- /dev/null
+++ b/www/pecl-yar/files/patch-php82
@@ -0,0 +1,47 @@
+Obtained from:	https://github.com/laruence/yar/pull/177
+
+--- tests/yar.inc.orig	2022-05-18 05:52:56 UTC
++++ tests/yar.inc
+@@ -105,17 +105,19 @@ PHP;
+ 
+ function yar_server_cleanup() {
+ 	$dir = dirname(__FILE__) . DIRECTORY_SEPARATOR . "htdocs";
+-	$dp = opendir($dir);
+-	while (($f = readdir($dp))) {
+-		if (in_array($f, array('.', '..'))) {
+-			continue;
++	if (is_dir($dir)) {
++		$dp = opendir($dir);
++		while (($f = readdir($dp))) {
++			if (in_array($f, array('.', '..'))) {
++				continue;
++			}
++			$path = $dir . DIRECTORY_SEPARATOR . $f;
++			if (is_file($path)) {
++				unlink($path);
++			}
+ 		}
+-		$path = $dir . DIRECTORY_SEPARATOR . $f;
+-		if (is_file($path)) {
+-			unlink($path);
+-		}
++		rmdir($dir);
+ 	}
+-	rmdir($dir);
+ }
+ 
+ /* For TCP */
+--- yar_request.c.orig	2022-05-18 05:52:56 UTC
++++ yar_request.c
+@@ -34,7 +34,11 @@
+ yar_request_t *php_yar_request_instance(zend_string *method, zend_array *parameters, void **options) /* {{{ */ {
+ 	yar_request_t *request = emalloc(sizeof(yar_request_t));
+ 
++#if PHP_VERSION_ID < 80200
+ 	if (!BG(mt_rand_is_seeded)) {
++#else
++	if (!RANDOM_G(mt19937_seeded)) {
++#endif
+ 		php_mt_srand(GENERATE_SEED());
+ 	}
+