diff --git a/classes/FileManager.php b/classes/FileManager.php index 5e3c0f8..fbcc216 100644 --- a/classes/FileManager.php +++ b/classes/FileManager.php @@ -362,7 +362,7 @@ public function extract_attempt_data_from_artifact(stored_file $artifactfile, in // Search for attempt path $attemptpath = null; foreach ($metadata as $row) { - if ($row[0] == $attemptid) { + if (intval($row[0]) === $attemptid) { $attemptpath = $row[9]; break; } diff --git a/tests/FileManager_test.php b/tests/FileManager_test.php index e42d672..110dae5 100644 --- a/tests/FileManager_test.php +++ b/tests/FileManager_test.php @@ -605,7 +605,7 @@ public function test_extract_attempt_data_for_nonexisting_attemptid(): void { // Extract userdata from artifact into temporary stored_file $this->expectException(\moodle_exception::class); $this->expectExceptionMessageMatches('/Attempt not found/'); - $fm->extract_attempt_data_from_artifact($storedArtifact, $job->get_id(), 0); + $fm->extract_attempt_data_from_artifact($storedArtifact, $job->get_id(), 9999999); } /**