Skip to content

Commit

Permalink
sync
Browse files Browse the repository at this point in the history
  • Loading branch information
dermatthes committed Jun 13, 2024
1 parent dba22b6 commit dd85ad6
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/SessionMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ public function __construct(
private int $ttl = 3600,
private int $expires = 86400,
private string $cookieName = "X-SESS",
private string $cookiePath = "/"
private ?string $cookiePath = null
) {

}


Expand Down Expand Up @@ -64,6 +65,15 @@ public function _createSession(string $sessionId, &$sessionDataRef): Session

public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{

if ($this->cookiePath === null) {
if ($this->app->has("router")) {
$this->cookiePath = $this->app->router->getRoutePrefix();
} else {
$this->cookiePath = "/";
}
}

$newSessionId = null;

$loadedSessionId = null;
Expand Down

0 comments on commit dd85ad6

Please sign in to comment.