mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00

https://wiki.php.net/rfc/rng_extension https://wiki.php.net/rfc/random_extension_improvement
22 lines
393 B
PHP
22 lines
393 B
PHP
--TEST--
|
|
Test error operation of random_bytes()
|
|
--FILE--
|
|
<?php
|
|
//-=-=-=-
|
|
|
|
try {
|
|
$bytes = random_bytes();
|
|
} catch (TypeError $e) {
|
|
echo $e->getMessage().PHP_EOL;
|
|
}
|
|
|
|
try {
|
|
$bytes = random_bytes(0);
|
|
} catch (Error $e) {
|
|
echo $e->getMessage().PHP_EOL;
|
|
}
|
|
|
|
?>
|
|
--EXPECT--
|
|
random_bytes() expects exactly 1 argument, 0 given
|
|
random_bytes(): Argument #1 ($length) must be greater than 0
|