The function declaration is as follows:
string crypt ( string $str [, string $salt ] )
But the documentation notes this:
The salt
parameter is optional. However, crypt()
creates a weak password without the salt
. PHP 5.6 or later raise an E_NOTICE
error without it. Make sure to specify a strong enough salt for better security.
That is to say, you will just have to ignore the notice if you want to continue using the function without a salt (which would be dumb), or use a salt.
Note, however, that the documentation continues on to say this:
password_hash()
uses a strong hash, generates a strong salt, and applies proper rounds automatically. password_hash()
is a simple crypt()
wrapper and compatible with existing password hashes. Use of password_hash()
is encouraged.
(That last emphasis is mine.)