Skip to content

Commit 2837eaf

Browse files
committed
Use random_bytes instead of deprecated mcrypt_create_iv
1 parent 65a3572 commit 2837eaf

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

tests/034.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ foreach ($datas as $data)
3131
for ($i = 0; $i < $len - 1; $i++)
3232
{
3333
$sub = substr($str, 0, $i);
34-
$sub .= mcrypt_create_iv(30, MCRYPT_DEV_URANDOM);
34+
$sub .= random_bytes(30);
3535
$php_errormsg = null;
3636
$v = msgpack_unserialize($sub);
3737
}

tests/035.phpt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
11
--TEST--
22
Profiling perf test.
33
--SKIPIF--
4-
<?php
5-
if (!extension_loaded("msgpack") || !extension_loaded("mcrypt")) {
6-
echo "skip";
7-
}
8-
?>
94
--FILE--
105
<?php
116
$data_array = array();
127
for ($i = 0; $i < 5000; $i++) {
13-
$data_array[mcrypt_create_iv(10, MCRYPT_DEV_URANDOM)] = mcrypt_create_iv(10, MCRYPT_DEV_URANDOM);
8+
$data_array[random_bytes(10)] = random_bytes(10);
149
}
1510

1611
$time_start = microtime(true);

0 commit comments

Comments
 (0)