1--TEST-- 2Test normal operation of password_needs_rehash() with Argon2i and Argon2id 3--SKIPIF-- 4<?php 5if (!defined('PASSWORD_ARGON2I')) die('skip password_needs_rehash not built with Argon2'); 6if (!defined('PASSWORD_ARGON2ID')) die('skip password_hash not built with Argon2'); 7?> 8--FILE-- 9<?php 10 11$hash = password_hash('test', PASSWORD_ARGON2I); 12var_dump(password_needs_rehash($hash, PASSWORD_ARGON2I)); 13var_dump(password_needs_rehash($hash, PASSWORD_ARGON2I, ['memory_cost' => PASSWORD_ARGON2_DEFAULT_MEMORY_COST * 2])); 14var_dump(password_needs_rehash($hash, PASSWORD_ARGON2I, ['time_cost' => PASSWORD_ARGON2_DEFAULT_TIME_COST + 1])); 15 16$hash = password_hash('test', PASSWORD_ARGON2ID); 17var_dump(password_needs_rehash($hash, PASSWORD_ARGON2ID)); 18var_dump(password_needs_rehash($hash, PASSWORD_ARGON2ID, ['memory_cost' => PASSWORD_ARGON2_DEFAULT_MEMORY_COST * 2])); 19var_dump(password_needs_rehash($hash, PASSWORD_ARGON2ID, ['time_cost' => PASSWORD_ARGON2_DEFAULT_TIME_COST + 1])); 20 21echo "OK!"; 22?> 23--EXPECT-- 24bool(false) 25bool(true) 26bool(true) 27bool(false) 28bool(true) 29bool(true) 30OK! 31