wilsoc31 Posted November 22, 2017 Share Posted November 22, 2017 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>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/305731-password-verify-throwing-weird-error/ Share on other sites More sharing options...
Psycho Posted November 22, 2017 Share Posted November 22, 2017 (edited) 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 November 22, 2017 by Psycho Quote Link to comment https://forums.phpfreaks.com/topic/305731-password-verify-throwing-weird-error/#findComment-1554023 Share on other sites More sharing options...
Barand Posted November 22, 2017 Share Posted November 22, 2017 Perhaps a "smart" single quote? Quote Link to comment https://forums.phpfreaks.com/topic/305731-password-verify-throwing-weird-error/#findComment-1554024 Share on other sites More sharing options...
wilsoc31 Posted November 22, 2017 Author Share Posted November 22, 2017 I haven't modified anyting this is the exact code and output. I have provided the entire php file Quote Link to comment https://forums.phpfreaks.com/topic/305731-password-verify-throwing-weird-error/#findComment-1554025 Share on other sites More sharing options...
wilsoc31 Posted November 22, 2017 Author Share Posted November 22, 2017 so what do you mean by smart single quotes? Quote Link to comment https://forums.phpfreaks.com/topic/305731-password-verify-throwing-weird-error/#findComment-1554026 Share on other sites More sharing options...
Barand Posted November 22, 2017 Share Posted November 22, 2017 Some word processing software substitutes typographical quotes for normal single and double quotes. Quote Link to comment https://forums.phpfreaks.com/topic/305731-password-verify-throwing-weird-error/#findComment-1554027 Share on other sites More sharing options...
SteamingAlong Posted November 25, 2017 Share Posted November 25, 2017 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. Quote Link to comment https://forums.phpfreaks.com/topic/305731-password-verify-throwing-weird-error/#findComment-1554117 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.