summaryrefslogtreecommitdiff
path: root/ext/standard/tests/password/password_needs_rehash_error.phpt
blob: aef86ee1247c8783d219a185acd167704f3cc118 (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
--TEST--
Test error operation of password_needs_rehash()
--FILE--
<?php

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

try {
    var_dump(password_needs_rehash('', []));
} catch (TypeError $e) {
    echo $e->getMessage(), "\n";
}

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

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

echo "OK!";
?>
--EXPECT--
password_needs_rehash() expects at least 2 parameters, 1 given
password_needs_rehash(): Argument #2 ($algo) must be of type string|int|null, array given
password_needs_rehash(): Argument #1 ($hash) must be of type string, array given
password_needs_rehash(): Argument #3 ($options) must be of type array, string given
OK!