summaryrefslogtreecommitdiff
path: root/ext/standard/tests/random/random_bytes_error.phpt
blob: 5a8b1d097c16f770f8dabd543b259713af4d19e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
--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 parameter, 0 given
random_bytes(): Argument #1 ($length) must be greater than 0