Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

password_hash is deprecated since PHP 7.0.0?

Tags:

php

php-7

I'm using php for visual studio, I was creating a sign-up form. When I was about to use the password_hash build-in PHP function, it showed me the following comment:

enter image description here

But when executing the function it works fine.

There is no information what so ever about it being deprecated in the PHP manual.

(PHP 5 >= 5.5.0, PHP 7)
password_hash — Creates a password hash

Am I missing something?

like image 797
Red Avatar asked Dec 24 '22 09:12

Red


1 Answers

This seems like a misreading of the password_hash() documentation, which states:

Warning The salt option has been deprecated as of PHP 7.0.0. It is now preferred to simply use the salt that is generated by default.

and

Caution It is strongly recommended that you do not generate your own salt for this function. It will create a secure salt automatically for you if you do not specify one.

As noted above, providing the salt option in PHP 7.0 will generate a deprecation warning. Support for providing a salt manually may be removed in a future PHP release.


Rest assured, password_hash() isn't deprecated (at the time of writing this).

like image 141
salathe Avatar answered Dec 30 '22 19:12

salathe