Hi,
I was having a really hard time figuring out why $this->cookies->get(token)->getValue()
returned NULL all the time.
Somehow the cookies were not being set.
I used return $this->response->redirect(index);
and that surpressed the following error
Size of key is too large for this algorithm
0 [internal function]: Phalcon\Crypt->encrypt('1', NULL)
1 [internal function]: Phalcon\Crypt->encryptBase64('1')
2 [internal function]: Phalcon\Http\Cookie->send()
3 [internal function]: Phalcon\Http\Response\Cookies->send()
4 [internal function]: Phalcon\Http\Response->sendCookies()
5 X:\path\public\index.php(33): Phalcon\Mvc\Application->handle()
6 {main}
Notice Phalcon\Crypt->encrypt(1, NULL)
where the key is empty!
Only after disabling encryption in the DI, the cookies were correctly set.
$di->set('cookies', function() {
$cookies = new Phalcon\Http\Response\Cookies();
$cookies->useEncryption(false);
return $cookies;
});
What could be the problem? I am using phalcon 1.2.6 because 1.3.1 wil not hash passwords for me (returns empty)
Thanx!