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 23
23
"ext-session" : " *" ,
24
24
"ext-sockets" : " *" ,
25
25
"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 " ,
29
29
"psr/container" : " ^1.0 || ^2.0" ,
30
30
"psr/event-dispatcher" : " ^1.0" ,
31
- "rector/rector" : " 2.0.9 " ,
31
+ "rector/rector" : " 2.0.16 " ,
32
32
"symfony/security-core" : " ^6.4 || ^7.2"
33
33
},
34
34
"conflict" : {
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ parameters:
25
25
path : src/Session/Middleware/InitializeSession.php
26
26
27
27
-
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\}\.$#'
29
29
identifier : offsetAccess.notFound
30
30
count : 1
31
31
path : src/Session/Reader/PhpReader.php
Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ public function close(): bool
66
66
return $ this ->handler ->close ();
67
67
}
68
68
69
- public function read (string $ id ): string
69
+ public function read (string $ id ): string | false
70
70
{
71
71
return $ this ->handler ->read ($ id );
72
72
}
Original file line number Diff line number Diff line change @@ -69,6 +69,9 @@ public function __construct(
69
69
$ this ->reader = $ reader ?? $ this ->createReader ();
70
70
}
71
71
72
+ /**
73
+ * @throws \RuntimeException if something goes wrong starting the session
74
+ */
72
75
public function start (): bool
73
76
{
74
77
if ($ this ->started && !$ this ->closed ) {
@@ -77,7 +80,13 @@ public function start(): bool
77
80
78
81
$ this ->saveHandler ->open (session_save_path (), $ this ->saveHandler ->getName ());
79
82
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 );
81
90
82
91
$ this ->loadSession ($ sessionData );
83
92
You can’t perform that action at this time.
0 commit comments