// bootstrap.php
$di->setShared('crypt', function()
{
$crypt = new \Phalcon\Crypt;
$crypt->setKey('asasasasasasasas'); // 16 bytes, it's no matter what symbols are used
return $crypt;
});
$di->setShared('cookies', function ()
{
$cookies = new \Phalcon\Http\Response\Cookies();
$cookies->useEncryption(true); // if false, bug is not reproduces
return $cookies;
});
class LoginController extends \Phalcon\Mvc\Controller
{
public function indexAction()
{
$token = $this->security->getSaltBytes(50);
$this->cookies->set('token', $token, time() + 31536000);
$result = base64_encode($token); // bTRscnRXTmlGUU1aZ3h6OEVyWGh5UQ==
...
class ProfileController extends \Phalcon\Mvc\Controller
{
public function indexAction()
{
$token = $this->cookies->get('token')->getValue();
$result = base64_encode($token); // bTRscnRXTmlGUU1aZ3h6OEVyWGh5UQAAAAAAAAAAAAA=
...
There are two separate pages, login and profile. Why extra bytes are added in decoded token?