Doc #69157 [Csd]: typo
Edit report at https://bugs.php.net/bug.php?id=69157&edit=1
ID: 69157
User updated by: zorro_damian at hotmail dot com
Reported by: zorro_damian at hotmail dot com
Summary: typo
Status: Closed
Type: Documentation Problem
Package: Unknown/Other Function
Operating System: Irrelevant
PHP Version: Irrelevant
Assigned To: aharvey
Block user comment: N
Private report: N
New Comment:
Yes, that's better! (-:
Previous Comments:
------------------------------------------------------------------------
[2015-03-02 18:04:16] aharvey@php.net
The fix for this bug has been committed.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
For Windows:
http://windows.php.net/snapshots/
Thank you for the report, and for helping us make PHP better.
Whoops. )))
------------------------------------------------------------------------
[2015-03-02 18:04:10] aharvey@php.net
Automatic comment from SVN on behalf of aharvey
Revision: http://svn.php.net/viewvc/?view=revision&revision=336026
Log: I parenthesis good.
Fixes doc bug #69157 (typo).
------------------------------------------------------------------------
[2015-03-02 13:42:33] zorro_damian at hotmail dot com
Description:
------------
Wrong example script at
http://php.net/manual/en/function.crypt.php
=> 'Example #1 crypt() examples'.
WRONG:
if (hash_equals($hashed_password, crypt($user_input, $hashed_password)) {
echo "Password verified!";
}
GOOD:
if (hash_equals($hashed_password, crypt($user_input, $hashed_password))) {
echo "Password verified!"; ^
} This fixes it.
The example script closes the: crypt(), hash_equals(), but not the if().
Test script:
---------------
<?php
$hashed_password = crypt('mypassword');
/* You should pass the entire results of crypt() as the salt for comparing a
password, to avoid problems when different hashing algorithms are used. (As
it says above, standard DES-based password hashing uses a 2-character salt,
but MD5-based hashing uses 12.) */
if (hash_equals($hashed_password, crypt($user_input, $hashed_password))) {
echo "Password verified!";
}
?>
Expected result:
----------------
Irrelevant
Actual result:
--------------
Irrelevant
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=69157&edit=1
Thread (3 messages)