D/Encryption cookies problem

I set the cookie looks like this is my service

 $di->set('cookies', function() {
            $cookies = new Phalcon\Http\Response\Cookies();

            return $cookies;
        });

And by the way the method $cookies->setEncryption(false); specified in this documentation http://docs.phalconphp.com/en/latest/reference/cookies.html#encryption-decryption-of-cookies does not work

I'm trying to (at the time of authorization) to get username of cookies, doing so

$username = $this->cookies->get('username'); $username_v = $username->getValue();

$usernamev vardump show string(32) "admin" that is not (5)

For this reason I can not get the data from the database using a login from cookies, help solve the problem

Покажи больше кода, и момент записи в куку и момент поиска по значению.

edited Apr '14

Got the same issue. Getting values doesn't work properly if using the encryption. var_dump of $this->cookies->get('username')->getValue() prints this:

string 'U1fI4UY3_mstXCmU61��������������' (length=32)

To clarify: the username is "U1fI4UY3_mstXCmU61" and I'm using v1.3.1.

This https://github.com/phalcon/cphalcon/issues/1150 helps, but I can't wrap every getValue() in rtrim().



7.2k

Just add

$crypt->setMode(MCRYPT_MODE_CFB);

to crypt service