MDL-83158 Unit tests: Exception when starting database session

Fixes an error where when reading a session the conditional
test never fails even when a session record doesn't
exist in the database.
This commit is contained in:
Matt Porritt 2024-09-16 20:21:41 +10:00 committed by Matt Porritt
parent 09e56f2d1a
commit 68ba22d80f

View File

@ -143,7 +143,7 @@ class database extends handler implements SessionHandlerInterface {
*/ */
public function read(string $sid): string|false { public function read(string $sid): string|false {
try { try {
if (!$record = $this->get_session_by_sid($sid)) { if (!$record = $this->database->get_record('sessions', ['sid' => $sid])) {
// Let's cheat and skip locking if this is the first access, // Let's cheat and skip locking if this is the first access,
// do not create the record here, let the manager do it after session init. // do not create the record here, let the manager do it after session init.
$this->failed = false; $this->failed = false;