Skip to content

Commit b2e21a3

Browse files
author
Greg Bowler
authored
feature: samesite lax (#249)
closes #248
1 parent e1e4df3 commit b2e21a3

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

src/FileHandler.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ public function open(string $savePath, string $name):bool {
3535
return $success;
3636
}
3737

38-
/**
39-
* @link http://php.net/manual/en/sessionhandlerinterface.close.php
40-
*/
38+
/** @link http://php.net/manual/en/sessionhandlerinterface.close.php */
4139
public function close():bool {
4240
return true;
4341
}

src/Session.php

+4-6
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class Session implements SessionContainer, TypeSafeGetter {
1616
const DEFAULT_SESSION_SECURE = true;
1717
const DEFAULT_SESSION_HTTPONLY = true;
1818
const DEFAULT_COOKIE_PATH = "/";
19-
const DEFAULT_COOKIE_SAMESITE = "Strict";
19+
const DEFAULT_COOKIE_SAMESITE = "Lax";
2020
const DEFAULT_STRICT_MODE = true;
2121
const DEFAULT_SESSION_ID_LENGTH = 64;
2222
const DEFAULT_SESSION_ID_BITS_PER_CHARACTER = 5;
@@ -29,7 +29,7 @@ class Session implements SessionContainer, TypeSafeGetter {
2929
public function __construct(
3030
SessionHandlerInterface $sessionHandler,
3131
array|ArrayAccess $config = [],
32-
string $id = null
32+
string $id = null,
3333
) {
3434
$this->sessionHandler = $sessionHandler;
3535

@@ -137,14 +137,12 @@ public function write():bool {
137137

138138
/** @param ArrayAccess<string, string>|array<string, string> $config */
139139
private function setIniDefaults(ArrayAccess|array $config):void {
140-
// phpcs:ignore
141-
@ini_set(
140+
ini_set(
142141
"session.sid_length",
143142
$config["sid_length"]
144143
?? self::DEFAULT_SESSION_ID_LENGTH
145144
);
146-
// phpcs:ignore
147-
@ini_set(
145+
ini_set(
148146
"session.sid_bits_per_character",
149147
$config["sid_bits_per_character"]
150148
?? (string)self::DEFAULT_SESSION_ID_BITS_PER_CHARACTER

0 commit comments

Comments
 (0)