Skip to content

Commit

Permalink
feature: samesite lax (#249)
Browse files Browse the repository at this point in the history
closes #248
  • Loading branch information
g105b authored May 25, 2023
1 parent e1e4df3 commit b2e21a3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
4 changes: 1 addition & 3 deletions src/FileHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ public function open(string $savePath, string $name):bool {
return $success;
}

/**
* @link http://php.net/manual/en/sessionhandlerinterface.close.php
*/
/** @link http://php.net/manual/en/sessionhandlerinterface.close.php */
public function close():bool {
return true;
}
Expand Down
10 changes: 4 additions & 6 deletions src/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Session implements SessionContainer, TypeSafeGetter {
const DEFAULT_SESSION_SECURE = true;
const DEFAULT_SESSION_HTTPONLY = true;
const DEFAULT_COOKIE_PATH = "/";
const DEFAULT_COOKIE_SAMESITE = "Strict";
const DEFAULT_COOKIE_SAMESITE = "Lax";
const DEFAULT_STRICT_MODE = true;
const DEFAULT_SESSION_ID_LENGTH = 64;
const DEFAULT_SESSION_ID_BITS_PER_CHARACTER = 5;
Expand All @@ -29,7 +29,7 @@ class Session implements SessionContainer, TypeSafeGetter {
public function __construct(
SessionHandlerInterface $sessionHandler,
array|ArrayAccess $config = [],
string $id = null
string $id = null,
) {
$this->sessionHandler = $sessionHandler;

Expand Down Expand Up @@ -137,14 +137,12 @@ public function write():bool {

/** @param ArrayAccess<string, string>|array<string, string> $config */
private function setIniDefaults(ArrayAccess|array $config):void {
// phpcs:ignore
@ini_set(
ini_set(
"session.sid_length",
$config["sid_length"]
?? self::DEFAULT_SESSION_ID_LENGTH
);
// phpcs:ignore
@ini_set(
ini_set(
"session.sid_bits_per_character",
$config["sid_bits_per_character"]
?? (string)self::DEFAULT_SESSION_ID_BITS_PER_CHARACTER
Expand Down

0 comments on commit b2e21a3

Please sign in to comment.