use php_mt_rand_range for 8.4

This commit is contained in:
Remi Collet
2024-07-10 14:43:24 +02:00
parent 15949865d9
commit d5a6b4bb2d

View File

@@ -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);