1--TEST--
2Test error operation of password_hash()
3--FILE--
4<?php
5//-=-=-=-
6
7var_dump(password_hash());
8
9var_dump(password_hash("foo"));
10
11var_dump(password_hash("foo", array()));
12
13var_dump(password_hash("foo", 19, new StdClass));
14
15var_dump(password_hash("foo", PASSWORD_BCRYPT, "baz"));
16
17var_dump(password_hash(array(), PASSWORD_BCRYPT));
18
19var_dump(password_hash("123", PASSWORD_BCRYPT, array("salt" => array())));
20
21/* Non-string salt, checking for memory leaks */
22var_dump(password_hash('123', PASSWORD_BCRYPT, array('salt' => 1234)));
23
24?>
25--EXPECTF--
26Warning: password_hash() expects at least 2 parameters, 0 given in %s on line %d
27NULL
28
29Warning: password_hash() expects at least 2 parameters, 1 given in %s on line %d
30NULL
31
32Notice: Array to string conversion in %s on line %d
33
34Warning: password_hash(): Unknown password hashing algorithm: Array in %s on line %d
35NULL
36
37Warning: password_hash(): Unknown password hashing algorithm: 19 in %s on line %d
38NULL
39
40Warning: password_hash() expects parameter 3 to be array, string given in %s on line %d
41NULL
42
43Warning: password_hash() expects parameter 1 to be string, array given in %s on line %d
44NULL
45
46Deprecated: password_hash(): Use of the 'salt' option to password_hash is deprecated in %s on line %d
47
48Warning: password_hash(): Non-string salt parameter supplied in %s on line %d
49NULL
50
51Deprecated: password_hash(): Use of the 'salt' option to password_hash is deprecated in %s on line %d
52
53Warning: password_hash(): Provided salt is too short: 4 expecting 22 in %s on line %d
54NULL
55