1--TEST--
2Test error operation of password_hash() with Argon2i and Argon2id
3--SKIPIF--
4<?php
5if (!defined('PASSWORD_ARGON2I')) die('skip password_hash not built with Argon2');
6if (!defined('PASSWORD_ARGON2ID')) die('skip password_hash not built with Argon2');
7?>
8--FILE--
9<?php
10var_dump(password_hash('test', PASSWORD_ARGON2I, ['memory_cost' => 0]));
11var_dump(password_hash('test', PASSWORD_ARGON2I, ['time_cost' => 0]));
12var_dump(password_hash('test', PASSWORD_ARGON2I, ['threads' => 0]));
13var_dump(password_hash('test', PASSWORD_ARGON2ID, ['memory_cost' => 0]));
14var_dump(password_hash('test', PASSWORD_ARGON2ID, ['time_cost' => 0]));
15var_dump(password_hash('test', PASSWORD_ARGON2ID, ['threads' => 0]));
16?>
17--EXPECTF--
18Warning: password_hash(): Memory cost is outside of allowed memory range in %s on line %d
19NULL
20
21Warning: password_hash(): Time cost is outside of allowed time range in %s on line %d
22NULL
23
24Warning: password_hash(): Invalid number of threads in %s on line %d
25NULL
26
27Warning: password_hash(): Memory cost is outside of allowed memory range in %s on line %d
28NULL
29
30Warning: password_hash(): Time cost is outside of allowed time range in %s on line %d
31NULL
32
33Warning: password_hash(): Invalid number of threads in %s on line %d
34NULL
35