1--TEST-- 2Test error operation of password_hash() 3--FILE-- 4<?php 5//-=-=-=- 6 7try { 8 var_dump(password_hash("foo")); 9} catch (TypeError $e) { 10 echo $e->getMessage(), "\n"; 11} 12 13try { 14 password_hash("foo", array()); 15} catch (TypeError $exception) { 16 echo $exception->getMessage() . "\n"; 17} 18 19try { 20 var_dump(password_hash("foo", 19, new StdClass)); 21} catch (TypeError $e) { 22 echo $e->getMessage(), "\n"; 23} 24 25try { 26 var_dump(password_hash("foo", PASSWORD_BCRYPT, "baz")); 27} catch (TypeError $e) { 28 echo $e->getMessage(), "\n"; 29} 30 31try { 32 var_dump(password_hash(array(), PASSWORD_BCRYPT)); 33} catch (TypeError $e) { 34 echo $e->getMessage(), "\n"; 35} 36 37?> 38--EXPECT-- 39password_hash() expects at least 2 arguments, 1 given 40password_hash(): Argument #2 ($algo) must be of type string|int|null, array given 41password_hash(): Argument #3 ($options) must be of type array, stdClass given 42password_hash(): Argument #3 ($options) must be of type array, string given 43password_hash(): Argument #1 ($password) must be of type string, array given 44