1--TEST-- 2Test error operation of password_hash() with bcrypt hashing 3--FILE-- 4<?php 5//-=-=-=- 6 7var_dump(password_hash("foo", PASSWORD_BCRYPT, array("cost" => 3))); 8 9var_dump(password_hash("foo", PASSWORD_BCRYPT, array("cost" => 32))); 10 11var_dump(password_hash("foo", PASSWORD_BCRYPT, array("salt" => "foo"))); 12 13var_dump(password_hash("foo", PASSWORD_BCRYPT, array("salt" => "123456789012345678901"))); 14 15var_dump(password_hash("foo", PASSWORD_BCRYPT, array("salt" => 123))); 16 17var_dump(password_hash("foo", PASSWORD_BCRYPT, array("cost" => "foo"))); 18 19?> 20--EXPECTF-- 21Warning: password_hash(): Invalid bcrypt cost parameter specified: 3 in %s on line %d 22NULL 23 24Warning: password_hash(): Invalid bcrypt cost parameter specified: 32 in %s on line %d 25NULL 26 27Warning: password_hash(): Provided salt is too short: 3 expecting 22 in %s on line %d 28NULL 29 30Warning: password_hash(): Provided salt is too short: 21 expecting 22 in %s on line %d 31NULL 32 33Warning: password_hash(): Provided salt is too short: 3 expecting 22 in %s on line %d 34NULL 35 36Warning: password_hash(): Invalid bcrypt cost parameter specified: 0 in %s on line %d 37NULL 38 39 40