File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed
tests/system/Session/Handlers/Database Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -223,7 +223,7 @@ public function close(): bool
223223
224224 if (($ pingReply === true ) || ($ pingReply === '+PONG ' )) {
225225 if (isset ($ this ->lockKey )) {
226- $ this ->redis -> del ( $ this -> lockKey );
226+ $ this ->releaseLock ( );
227227 }
228228
229229 if (! $ this ->redis ->close ()) {
Original file line number Diff line number Diff line change @@ -168,4 +168,26 @@ public function testGC(): void
168168 $ handler = $ this ->getInstance ();
169169 $ this ->assertSame (1 , $ handler ->gc (3600 ));
170170 }
171+
172+ /**
173+ * See https://github.com/codeigniter4/CodeIgniter4/issues/7695
174+ */
175+ public function testSecondaryReadAfterClose (): void
176+ {
177+ $ handler = $ this ->getInstance ();
178+ $ handler ->open ($ this ->sessionSavePath , $ this ->sessionName );
179+
180+ $ expected = <<<'DATA'
181+ __ci_last_regenerate|i:1664607454;_ci_previous_url|s:32:"http://localhost:8080/index.php/";key|s:5:"value";
182+ DATA;
183+ $ this ->assertSame ($ expected , $ handler ->read ('555556b43phsnnf8if6bo33b635e4447 ' ));
184+
185+ $ handler ->close ();
186+
187+ $ handler ->open ($ this ->sessionSavePath , $ this ->sessionName );
188+
189+ $ this ->assertSame ($ expected , $ handler ->read ('555556b43phsnnf8if6bo33b635e4447 ' ));
190+
191+ $ handler ->close ();
192+ }
171193}
You can’t perform that action at this time.
0 commit comments