summaryrefslogtreecommitdiffstats
path: root/0001-restore-7.0-compatibility.patch
blob: 766e600275f6100dc52c78079dc5b83cfd1b94e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
From 70f260f6e395af7c6061e2b07ea91b85b28532f1 Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@php.net>
Date: Tue, 8 Oct 2024 10:31:48 +0200
Subject: [PATCH] restore 7.0 compatibility

---
 provider.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/provider.c b/provider.c
index f1f8e2a..5f988b5 100644
--- a/provider.c
+++ b/provider.c
@@ -960,7 +960,11 @@ SOP_METHOD(generateToken)
 			php_error_docref(NULL, E_WARNING, "Could not gather enough random data, falling back on rand()");
 		}
 		while (reaped < size) {
+#if PHP_VERSION_ID < 70100
+			iv[reaped++] = (char) (255.0 * php_rand() / RAND_MAX);
+#else
 			iv[reaped++] = (char)php_mt_rand_range(0, 255);
+#endif
 		}
 	}
 
-- 
2.46.2