Reputation: 1
An ErrorException occurred in my code $user->password = Hash::make(Input::get('password')); saying password_hash(): Password must be a string. I am using laravel framework
$user = new User();
$user->username = Input::get('username');
$user->password = Hash::make(Input::get('password'));
if($user->save())
{
return Redirect::route('home')->with('success','You register successfully. You can now login');
} else {
return Redirect::route('home')->with('fail','An error occurred while creating user. Please try again.');
}
Upvotes: 0
Views: 975
Reputation: 1929
I had similar issue on a Linux machine which threw in
ErrorException
password_hash(): Password must be a string
By upgrading PHP from PHP 5.4 to PHP 5.5 it solved it on my Laravel environment.
Upvotes: 0
Reputation: 43
I experienced the same issue, using wamp 2.4 which comes with PHP 5.4, but after upgrading to wamp 2.5 which comes with php 5.5, it was solved so thats solution number 1:
Still looking for a solution that doesnt require an upgrade because on Laravel's documentation, it mentions that 5.4+ is supported for Laravel 4.2
Upvotes: 1