0

I try to get the $app->setCookies() and $app->getCookies() to work.

So heres my $app config:

$app = new \Slim\Slim(array(
    'view' => new \Slim\Views\Twig(),
    'debug' => true,
    'cookies.encrypt' => false,              // <= so it is no encrypt bug
    'cookies.secret_key' => '6yxwi8fg4tr72', // <= just random digits
    'cookies.cipher' => MCRYPT_RIJNDAEL_256,
    'cookies.cipher_mode' => MCRYPT_MODE_CBC
));

The Middleware that I added is just injecting some variables. [No SessionMiddleware]

$app->get('/login',function () use ($app) {
    $app->setCookie('admin', true);
    $app->redirectTo('home');
});

According to the Answer on: Why won't asp.net create cookies in localhost? edited the /etc/hosts file.

However no matter what I do, whenever $app->setCookies() is called, I retrieve only a blank page. If I comment it out, I get redirected to my homepage. No errors are thrown as well.

Community
  • 1
  • 1
Dornathal
  • 882
  • 9
  • 16

1 Answers1

0

I looked into my composer.json settings and found a dependency on doctrine/cache what seemed to interfere.

{
    "require": {
        "php": ">=5.4",
        "ext-mcrypt": "*",
        "pimple/pimple": "3.*",
        "slim/slim": "~2.0",
        "slim/views": "0.1.*",
        "twig/twig": "1.18.*",
        "propel/propel": "~2.0@dev"
    },

    "autoload": {
        "classmap": ["website/", "generated-conf/"]
    }
}

Now with these settings the cookies are working fine.

Dornathal
  • 882
  • 9
  • 16