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>"; ?> Link to comment Share on other sites More sharing options...
Psycho Posted November 22, 2017 Share Posted November 22, 2017 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. Link to comment Share on other sites More sharing options...
Barand Posted November 22, 2017 Share Posted November 22, 2017 Perhaps a "smart" single quote? Link to comment 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 Link to comment 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? Link to comment 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. Link to comment 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. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.