Skip to content

Commit eafbeee

Browse files
committed
Make it work with PHP 8.4 and PHP 8.5
1 parent 6108021 commit eafbeee

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

mcrypt.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,11 @@
3838
#include "php_ini.h"
3939
#include "php_globals.h"
4040
#include "ext/standard/info.h"
41-
#include "ext/standard/php_rand.h"
41+
#if PHP_VERSION_ID >= 80400
42+
# include "ext/random/php_random.h"
43+
#else
44+
# include "ext/standard/php_rand.h"
45+
#endif
4246
#include "zend_smart_str.h"
4347
#include "php_mcrypt_filter.h"
4448

@@ -1414,7 +1418,11 @@ PHP_FUNCTION(mcrypt_create_iv)
14141418
} else {
14151419
n = (int)size;
14161420
while (size) {
1421+
#if PHP_VERSION_ID >= 80400
1422+
iv[--size] = (char) (255.0 * php_mt_rand() / RAND_MAX);
1423+
#else
14171424
iv[--size] = (char) (255.0 * php_rand() / RAND_MAX);
1425+
#endif
14181426
}
14191427
}
14201428
RETVAL_STRINGL(iv, n);

0 commit comments

Comments
 (0)