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
32Warning: password_hash() expects parameter 2 to be integer, array given in %s on line %d
33NULL
34
35Warning: password_hash(): Unknown password hashing algorithm: 19 in %s on line %d
36NULL
37
38Warning: password_hash() expects parameter 3 to be array, string given in %s on line %d
39NULL
40
41Warning: password_hash() expects parameter 1 to be string, array given in %s on line %d
42NULL
43
44Deprecated: password_hash(): Use of the 'salt' option to password_hash is deprecated in %s on line %d
45
46Warning: password_hash(): Non-string salt parameter supplied in %s on line %d
47NULL
48
49Deprecated: password_hash(): Use of the 'salt' option to password_hash is deprecated in %s on line %d
50
51Warning: password_hash(): Provided salt is too short: 4 expecting 22 in %s on line %d
52NULL
53