Skip to content

Commit

Permalink
Fix FileManager invalid attempt during artifact extraction test case …
Browse files Browse the repository at this point in the history
…on PHP 7.4
  • Loading branch information
ngandrass committed May 29, 2024
1 parent 9c00182 commit 85f580c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion classes/FileManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/FileManager_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down

0 comments on commit 85f580c

Please sign in to comment.