CodeIgniter Forums
->insert losing hash chars - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forum-28.html)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forum-30.html)
+--- Thread: ->insert losing hash chars (/thread-68210.html)



->insert losing hash chars - donpwinston - 06-10-2017

In CI4 I insert a hash 

$2y$10$trkKDMz5PR6xv0tV2UUoOeGpsIwMi5DEt6Hfvmc5RjcIsp2zeNXD.

When I look in the db it is

y$trkKDMz5PR6xv0tV2UUoOeGpsIwMi5DEt6Hfvmc5RjcIsp2zeNXD.

Here's the code:

} else {
$hashed_password = password_hash(trim($this->request->getPost('password')), PASSWORD_DEFAULT);
log_message('debug', $hashed_password);
$model = new \App\Models\UsersModel();
$model->insert([
'username' => trim($this->request->getPost('username')),
'password' => $hashed_password,
'email' => $this->request->getPost('email'),
'tpseq' => $this->request->getPost('tpseq'),
]);
redirect('/login');
}

Anyone have an idea of how can this be?

Also the ->first() method doesn't seem to work.


RE: ->insert losing hash chars - kilishan - 06-11-2017

Is this with the very latest version of the code? A fix for something similar to that was put in place a while ago. Please update the code and let me know if you're still seeing it. If you are it's a bug and should be reported over at GitHub.


RE: ->insert losing hash chars - donpwinston - 06-11-2017

I upgraded to the latest version and the problem still occurs.