From ad51a435dfd33da4fdc71a3d25bfcc16b693ebd5 Mon Sep 17 00:00:00 2001 From: Dave Mc Nicoll Date: Fri, 22 Oct 2021 14:33:14 +0000 Subject: [PATCH] - Fixed some bug related to path and domain options --- src/Cookie.php | 2 +- src/SessionMiddleware.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Cookie.php b/src/Cookie.php index adc63fa..4dc38e3 100644 --- a/src/Cookie.php +++ b/src/Cookie.php @@ -4,7 +4,7 @@ namespace Storage; class Cookie { - protected array $options = [ + public array $options = [ 'expires' => 0, 'path' => null, 'domain' => null, diff --git a/src/SessionMiddleware.php b/src/SessionMiddleware.php index 19bd20a..8585569 100644 --- a/src/SessionMiddleware.php +++ b/src/SessionMiddleware.php @@ -33,7 +33,7 @@ class SessionMiddleware implements MiddlewareInterface $options['name'] = md5(__FILE__); } - $this->options = array_merge($this->options, $options); + $this->options = array_merge($this->options, array_filter(array_intersect_key($this->cookie->options, array_flip(['path', 'domain', 'samesite']))), $options); $this->savePath = $savePath ?? sys_get_temp_dir(); }