mirror of
https://github.com/php/php-src.git
synced 2025-08-20 09:24:05 +02:00

CSPRNG implementations should always fail closed. Now openssl_random_pseudo_bytes() will fail closed by throwing an `\Exception` in fail conditions. RFC: https://wiki.php.net/rfc/improve-openssl-random-pseudo-bytes
14 lines
291 B
PHP
14 lines
291 B
PHP
--TEST--
|
|
Test error operation of openssl_random_pseudo_bytes()
|
|
--SKIPIF--
|
|
<?php if (!extension_loaded("openssl")) print "skip"; ?>
|
|
--FILE--
|
|
<?php
|
|
try {
|
|
openssl_random_pseudo_bytes(0);
|
|
} catch (Error $e) {
|
|
echo $e->getMessage().PHP_EOL;
|
|
}
|
|
?>
|
|
--EXPECTF--
|
|
Length must be greater than 0
|