Skip to content

Commit

Permalink
Don't write sessions when cookies are not present
Browse files Browse the repository at this point in the history
Signed by Shawn Bulen, [email protected]
  • Loading branch information
sbulen committed Jan 7, 2025
1 parent e94bbe6 commit fdd5999
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Sources/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ public function read(string $session_id): string
*/
public function write(string $session_id, string $data): bool
{

// Don't both writing the session if cookies are diabled
if (empty($_COOKIE))
return true;

if (preg_match('~^[A-Za-z0-9,-]{16,64}$~', $session_id) == 0) {
return false;
}
Expand Down

0 comments on commit fdd5999

Please sign in to comment.