CodeIgniter Forums
password_hash returning empty password in database - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: password_hash returning empty password in database (/showthread.php?tid=83081)



password_hash returning empty password in database - MaestheticX - 09-17-2022

Hello, thank you for viewing my question. I tried to do hashing for my registration. This is my code for password hashing.

PHP Code:
if(isset($data['data']['password']))
        {
            $data['data']['password'] = password_hash($data['data']['password'], PASSWORD_DEFAULT);
      
            
unset($data['data']['password']);
        }

        return $data


I seriously don't know what I did wrong. I tried to unset by following this (https://forum.codeigniter.com/post-376484.html), 
the password_verify() will return error of :


Quote:ErrorException password_verify(): Passing null to parameter #2 ($hash) of type string is deprecated

This is the code from Login controller :

PHP Code:
if (password_verify($password$UserModel->password_hash)) {
                
                
echo "Login ok";
                
            
} else {
                
                
echo "Login not ok";