From 15ece2444d614bac545b5d1cd7ea86a2881a9ddd Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Mon, 19 Sep 2022 13:12:47 +0200 Subject: [PATCH 1/2] fix random seed check for PHP 8 --- yar_request.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/yar_request.c b/yar_request.c index be6a41b..59f527e 100644 --- a/yar_request.c +++ b/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()); } From 865d2e0615fcfb969db87f254792ec3844600280 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Mon, 19 Sep 2022 13:13:01 +0200 Subject: [PATCH 2/2] fix tests for PHP 8.2 --- tests/yar.inc | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/tests/yar.inc b/tests/yar.inc index d5c3693..d096f88 100644 --- a/tests/yar.inc +++ b/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; - } - $path = $dir . DIRECTORY_SEPARATOR . $f; - if (is_file($path)) { - unlink($path); + 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); + } } + rmdir($dir); } - rmdir($dir); } /* For TCP */