Skip to content

Commit

Permalink
fix cookie expire value from CsrfComponent not used
Browse files Browse the repository at this point in the history
CsrfComponent uses key 'expiry' while Network\Response uses 'expire'
  • Loading branch information
Schlaefer committed Jun 25, 2015
1 parent 25d6753 commit 22dae85
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Controller/Component/CsrfComponent.php
Expand Up @@ -125,7 +125,7 @@ protected function _setCookie(Request $request, Response $response)
$response->cookie([
'name' => $this->_config['cookieName'],
'value' => $value,
'expiry' => $this->_config['expiry'],
'expire' => $this->_config['expiry'],
'path' => $request->webroot,
'secure' => $this->_config['secure'],
]);
Expand Down
4 changes: 2 additions & 2 deletions tests/TestCase/Controller/Component/CsrfComponentTest.php
Expand Up @@ -72,7 +72,7 @@ public function testSettingCookie()
$cookie = $controller->response->cookie('csrfToken');
$this->assertNotEmpty($cookie, 'Should set a token.');
$this->assertRegExp('/^[a-f0-9]+$/', $cookie['value'], 'Should look like a hash.');
$this->assertEquals(0, $cookie['expiry'], 'session duration.');
$this->assertEquals(0, $cookie['expire'], 'session duration.');
$this->assertEquals('/dir/', $cookie['path'], 'session path.');

$this->assertEquals($cookie['value'], $controller->request->params['_csrfToken']);
Expand Down Expand Up @@ -273,7 +273,7 @@ public function testConfigurationCookieCreate()
$cookie = $controller->response->cookie('token');
$this->assertNotEmpty($cookie, 'Should set a token.');
$this->assertRegExp('/^[a-f0-9]+$/', $cookie['value'], 'Should look like a hash.');
$this->assertEquals(90, $cookie['expiry'], 'session duration.');
$this->assertEquals(90, $cookie['expire'], 'session duration.');
$this->assertEquals('/dir/', $cookie['path'], 'session path.');
$this->assertTrue($cookie['secure'], 'cookie security flag missing');
}
Expand Down

0 comments on commit 22dae85

Please sign in to comment.