Doc #81299 [Opn->Ver]: password_hash() documentation is missing PHP 8 changes
| From: | cmb@php.net | Date: | Mon, 26 Jul 2021 11:20:29 +0000 |
| Subject: | Doc #81299 [Opn->Ver]: password_hash() documentation is missing PHP 8 changes | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-18993@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=81299&edit=1
ID: 81299
Updated by: cmb@php.net
Reported by: enumag at gmail dot com
Summary: password_hash() documentation is missing PHP 8
changes
-Status: Open
+Status: Verified
Type: Documentation Problem
Package: Documentation problem
Operating System: any
PHP Version: 8.0.8
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
> Documentation claims it returns string or false but if you pass
> an invalid algorithm it actually returns NULL on PHP 7.3 and 7.4.
From the docs[1]:
| If the parameters given to a function are not what it expects,
| such as passing an array where a string is expected, the return
| value of the function is undefined. In this case it will likely
| return null but this is just a convention, and cannot be relied
| upon.
[1] <https://www.php.net/manual/en/functions.internal.php>
Previous Comments:
------------------------------------------------------------------------
[2021-07-26 09:57:11] enumag at gmail dot com
Also it seems that return value is not correctly documented for older PHP versions either.
Documentation claims it returns string or false but if you pass an invalid algorithm it actually
returns NULL on PHP 7.3 and 7.4.
https://3v4l.org/vugc3
------------------------------------------------------------------------
[2021-07-26 09:48:42] enumag at gmail dot com
Description:
------------
In PHP 8 password_hash seems to be change to always return string or throw an error. Meaning it can
no longer return false on null.
See https://3v4l.org/dtcXu
This change however is not documented: https://www.php.net/manual/en/function.password-hash.php
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=81299&edit=1