summaryrefslogtreecommitdiff
path: root/ext/standard/tests/password/password_hash_error.phpt
blob: a9e26f091675e17299c9894a610dc16e4eda10af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
--TEST--
Test error operation of password_hash()
--FILE--
<?php
//-=-=-=-

try {
    var_dump(password_hash("foo"));
} catch (TypeError $e) {
    echo $e->getMessage(), "\n";
}

try {
    password_hash("foo", array());
} catch (TypeError $exception) {
    echo $exception->getMessage() . "\n";
}

try {
    var_dump(password_hash("foo", 19, new StdClass));
} catch (TypeError $e) {
    echo $e->getMessage(), "\n";
}

try {
    var_dump(password_hash("foo", PASSWORD_BCRYPT, "baz"));
} catch (TypeError $e) {
    echo $e->getMessage(), "\n";
}

try {
    var_dump(password_hash(array(), PASSWORD_BCRYPT));
} catch (TypeError $e) {
    echo $e->getMessage(), "\n";
}

?>
--EXPECT--
password_hash() expects at least 2 arguments, 1 given
password_hash(): Argument #2 ($algo) must be of type string|int|null, array given
password_hash(): Argument #3 ($options) must be of type array, stdClass given
password_hash(): Argument #3 ($options) must be of type array, string given
password_hash(): Argument #1 ($password) must be of type string, array given