summaryrefslogtreecommitdiffstats
path: root/19.patch
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2024-10-14 09:47:52 +0200
committerRemi Collet <remi@php.net>2024-10-14 09:47:52 +0200
commitdab36f55dbf32082a02a263245a170a8ac66e8d7 (patch)
tree02ea9d5488b075fda92e889c37dda2a29581313c /19.patch
parentb186c7bc550b2b522dd4c2f64ac2ff24dd173432 (diff)
fix build with PHP 8.4 using patch fromHEADmaster
https://github.com/php/pecl-encryption-mcrypt/pull/19
Diffstat (limited to '19.patch')
-rw-r--r--19.patch34
1 files changed, 34 insertions, 0 deletions
diff --git a/19.patch b/19.patch
new file mode 100644
index 0000000..e3fa273
--- /dev/null
+++ b/19.patch
@@ -0,0 +1,34 @@
+From d5a6b4bb2d9704b69ff121356e1e5a65080dfdaf Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@php.net>
+Date: Wed, 10 Jul 2024 14:43:24 +0200
+Subject: [PATCH] use php_mt_rand_range for 8.4
+
+---
+ mcrypt.c | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/mcrypt.c b/mcrypt.c
+index b834ffe..cf2a8d4 100644
+--- a/mcrypt.c
++++ b/mcrypt.c
+@@ -38,7 +38,11 @@
+ #include "php_ini.h"
+ #include "php_globals.h"
+ #include "ext/standard/info.h"
++#if PHP_VERSION_ID < 80400
+ #include "ext/standard/php_rand.h"
++#else
++#include "ext/random/php_random.h"
++#endif
+ #include "zend_smart_str.h"
+ #include "php_mcrypt_filter.h"
+
+@@ -1414,7 +1418,7 @@ PHP_FUNCTION(mcrypt_create_iv)
+ } else {
+ n = (int)size;
+ while (size) {
+- iv[--size] = (char) (255.0 * php_rand() / RAND_MAX);
++ iv[--size] = (char)php_mt_rand_range(0, 255);
+ }
+ }
+ RETVAL_STRINGL(iv, n);