Skip to content

Commit c02cde4

Browse files
committed
SessionExtension: option session.cookieSecure is deprecated, http.cookieSecure is used (BC break)
1 parent f554118 commit c02cde4

File tree

3 files changed

+6
-76
lines changed

3 files changed

+6
-76
lines changed

src/Bridges/HttpDI/SessionExtension.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,9 @@ public function loadConfiguration()
6464
if (($config->cookieDomain ?? null) === 'domain') {
6565
$config->cookieDomain = $builder::literal('$this->getByType(Nette\Http\IRequest::class)->getUrl()->getDomain(2)');
6666
}
67-
if (($config->cookieSecure ?? null) === 'auto') {
68-
$config->cookieSecure = $builder::literal('$this->getByType(Nette\Http\IRequest::class)->isSecured()');
67+
if (isset($config->cookieSecure)) {
68+
trigger_error("The item 'session › cookieSecure' is deprecated, use 'http › cookieSecure' (it has default value 'auto').", E_USER_DEPRECATED);
69+
unset($config->cookieSecure);
6970
}
7071
if ($config->cookieSamesite === true) {
7172
trigger_error("In 'session › cookieSamesite' replace true with 'Lax'.", E_USER_DEPRECATED);

tests/Http.DI/SessionExtension.config.phpt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@ $compiler->addExtension('session', new SessionExtension(false, PHP_SAPI === 'cli
2121

2222
$loader = new DI\Config\Loader;
2323
$config = $loader->load(Tester\FileMock::create('
24+
foo:
25+
cookieSecure: yes
26+
2427
session:
2528
cookiePath: /x
2629
cookieDomain: domain
27-
cookieSecure: yes
2830
cookieSamesite: Lax
2931
3032
services:

tests/Http.DI/SessionExtension.cookieSecure.auto.phpt

Lines changed: 0 additions & 73 deletions
This file was deleted.

0 commit comments

Comments
 (0)