File tree Expand file tree Collapse file tree 4 files changed +16
-7
lines changed
Expand file tree Collapse file tree 4 files changed +16
-7
lines changed Original file line number Diff line number Diff line change 2323 "ext-session" : " *" ,
2424 "ext-sockets" : " *" ,
2525 "phpstan/extension-installer" : " ^1.4.3" ,
26- "phpstan/phpstan" : " 2.1.6 " ,
27- "phpstan/phpstan-phpunit" : " 2.0.4 " ,
28- "phpunit/phpunit" : " 12.0.5 " ,
26+ "phpstan/phpstan" : " 2.1.17 " ,
27+ "phpstan/phpstan-phpunit" : " 2.0.6 " ,
28+ "phpunit/phpunit" : " 12.1.6 " ,
2929 "psr/container" : " ^1.0 || ^2.0" ,
3030 "psr/event-dispatcher" : " ^1.0" ,
31- "rector/rector" : " 2.0.9 " ,
31+ "rector/rector" : " 2.0.16 " ,
3232 "symfony/security-core" : " ^6.4 || ^7.2"
3333 },
3434 "conflict" : {
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ parameters:
2525 path : src/Session/Middleware/InitializeSession.php
2626
2727 -
28- message : ' #^Offset 1 might not exist on array\{0\: string, 1\?\: numeric\-string\}\.$#'
28+ message : ' #^Offset 1 might not exist on array\{0\: non\-falsy\- string, 1\?\: numeric\-string\}\.$#'
2929 identifier : offsetAccess.notFound
3030 count : 1
3131 path : src/Session/Reader/PhpReader.php
Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ public function close(): bool
6666 return $ this ->handler ->close ();
6767 }
6868
69- public function read (string $ id ): string
69+ public function read (string $ id ): string | false
7070 {
7171 return $ this ->handler ->read ($ id );
7272 }
Original file line number Diff line number Diff line change @@ -69,6 +69,9 @@ public function __construct(
6969 $ this ->reader = $ reader ?? $ this ->createReader ();
7070 }
7171
72+ /**
73+ * @throws \RuntimeException if something goes wrong starting the session
74+ */
7275 public function start (): bool
7376 {
7477 if ($ this ->started && !$ this ->closed ) {
@@ -77,7 +80,13 @@ public function start(): bool
7780
7881 $ this ->saveHandler ->open (session_save_path (), $ this ->saveHandler ->getName ());
7982
80- $ sessionData = $ this ->reader ->read ($ this ->saveHandler ->read ($ this ->saveHandler ->getId ()));
83+ $ data = $ this ->saveHandler ->read ($ this ->saveHandler ->getId ());
84+
85+ if (false === $ data ) {
86+ throw new \RuntimeException ('Failed to start the session. ' );
87+ }
88+
89+ $ sessionData = $ this ->reader ->read ($ data );
8190
8291 $ this ->loadSession ($ sessionData );
8392
You can’t perform that action at this time.
0 commit comments