[PECL-CVS] [pecl-web_services-oauth] master: Do not use php_mt_rand_range for PHP 7.0

[email protected] (Dimitar Nikov via Michael Wallner)
Newsgroups php.pecl.cvs
Message-ID <[email protected]>
Author: Dimitar Nikov (arruor)
Committer: Michael Wallner (m6w6)
Date: 2025-08-20T09:26:46+02:00

Commit: https://github.com/php/pecl-web_services-oauth/commit/bedf5493c47a34b3edf856ae74dd471a47258cbd
Raw diff: https://github.com/php/pecl-web_services-oauth/commit/bedf5493c47a34b3edf856ae74dd471a47258cbd.diff

Do not use php_mt_rand_range for PHP 7.0

Changed paths:
  M  provider.c


Diff:

diff --git a/provider.c b/provider.c
index f1f8e2a..9864202 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
 		}
 	}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.