Skip to content

PHP Warning: password_hash() expects at least 2 parameters, 0 given in /var/www/html/vtiger6/vtlib/Vtiger/Functions.php

On PHP versions 5.5 and above (where this function exists) you are calling the PHP function password_hash() but without any parameters!

static function generateEncryptedPassword($password, $mode='CRYPT') {
	if ($mode == 'MD5') return md5($password);
	if ($mode == 'CRYPT') {
		$salt = null;
		if (function_exists('password_hash')) { // php 5.5+
			$salt = password_hash();
		} else {
			$salt = '$2y$11$'.str_replace("+",".",substr(base64_encode(openssl_random_pseudo_bytes(17)),0,22));
		}
		return crypt($password, $salt);
	}
	throw new Exception('Invalid encryption mode: '.$mode);
}