Bug #80297 [Opn->Nab]: password_verify won't work with double quotes
| From: | peehaa@php.net | Date: | Thu, 29 Oct 2020 19:54:35 +0000 |
| Subject: | Bug #80297 [Opn->Nab]: password_verify won't work with double quotes | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-230018@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=80297&edit=1
ID: 80297
Updated by: peehaa@php.net
Reported by: brennen at swedecreek dot com
Summary: password_verify won't work with double quotes
-Status: Open
+Status: Not a bug
Type: Bug
Package: *Encryption and hash functions
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions. Due to the volume
of reports we can not explain in detail here why your report is not
a bug. The support channels will be able to provide an explanation
for you.
Thank you for your interest in PHP.
Previous Comments:
------------------------------------------------------------------------
[2020-10-29 18:55:16] rtrtrtrtrt at dfdfdfdf dot dfd
php > if(password_verify("helloworld",
"\$2y\$10\$nqqnTXGG/W4kNWDQ6Zlx8uNbduUfYmn/iS7eKOj9fbG6iVa.3dOAi")) {echo
"Success";} else {echo "Fail";}
Success
php >
------------------------------------------------------------------------
[2020-10-29 18:54:18] rtrtrtrtrt at dfdfdfdf dot dfd
because you lack basics and proper error-reporting
in double quotes you need to secape $ as \$
----------------
Interactive shell
php > if(password_verify("helloworld",
"$2y$10$nqqnTXGG/W4kNWDQ6Zlx8uNbduUfYmn/iS7eKOj9fbG6iVa.3dOAi")) {echo
"Success";} else {echo "Fail";}
Notice: Undefined variable: nqqnTXGG in php shell code on line 1
Fail
------------------------------------------------------------------------
[2020-10-29 18:50:49] brennen at swedecreek dot com
Description:
------------
When using double quotes around $hash in password_verify, it always returns false. You have to use
double quotes.
Test script:
---------------
if(password_verify("helloworld",
"$2y$10$nqqnTXGG/W4kNWDQ6Zlx8uNbduUfYmn/iS7eKOj9fbG6iVa.3dOAi")) {
echo "Success";
}
else {
echo "Fail";
}
Expected result:
----------------
Success
Actual result:
--------------
Fail
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=80297&edit=1