xref: /PHP-8.1/ext/hash/tests/hash_error.phpt (revision b5c7a83d)
1--TEST--
2Hash: hash() function : error conditions
3--FILE--
4<?php
5
6echo "*** Testing hash() : error conditions ***\n";
7
8echo "\n-- Testing hash() function with invalid hash algorithm --\n";
9try {
10    hash('foo', '');
11} catch (ValueError $exception) {
12    echo $exception->getMessage() . "\n";
13}
14
15?>
16--EXPECT--
17*** Testing hash() : error conditions ***
18
19-- Testing hash() function with invalid hash algorithm --
20hash(): Argument #1 ($algo) must be a valid hashing algorithm
21