Jump to content

Recommended Posts

Can anyone please help me?  normally i can fix this error but for some reason it just doesnt make since in this case to me.  

 

The error im getting is:

Parse error: syntax error, unexpected ''$2y$10$fFYyZWTdAcewqFByXX5Wvu' (T_CONSTANT_ENCAPSED_STRING) in

/home/xxxx/xxxxxxxx.com/pass_test.php on line 2

 

here is the code:

<?php 
$hash = '$2y$10$fFYyZWTdAcewqFByXX5Wvu/UuAk8dwYYjOV27SN/9RPea6TeU9Q0u';

if (password_verify('rasmuslerdorf', $hash)) {
    echo 'Password is valid!';
} else {
    echo 'Invalid password.';
}

echo "<br>";
$options10 = [ 'cost' => 10,];
$hash = password_hash('test',PASSWORD_BCRYPT,$options10);
echo "10: ".$hash;
echo "<br>";
?>
Link to comment
https://forums.phpfreaks.com/topic/305731-password-verify-throwing-weird-error/
Share on other sites

I get no such error when running that code. I suspect either 1) You modified the posted code somewhat from the actual coded causing the error or 2) There are non-printing characters in the file causing a problem.

Edited by Psycho

Actually, in line 2 you are showing

$hash = '$2y$10$fFYyZWTdAcewqFByXX5Wvu/UuAk8dwYYjOV27SN/9RPea6TeU9Q0u';

I have highlighted in red to what is exactly causing the error "/". I came across this a while back with my tests but just ended moving to PASSWORD_DEFAULT and prepared it for it's changes in the future.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.