From f866ca5a840514fb19425bde1925b65336279858 Mon Sep 17 00:00:00 2001 From: ItsNiklas Date: Thu, 23 Nov 2023 10:31:43 +0100 Subject: [PATCH] Submission: Use `str_ends_with` --- webapp/src/Service/SubmissionService.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/webapp/src/Service/SubmissionService.php b/webapp/src/Service/SubmissionService.php index 9d503fffee..c53cd17e45 100644 --- a/webapp/src/Service/SubmissionService.php +++ b/webapp/src/Service/SubmissionService.php @@ -530,9 +530,7 @@ public function submitSolution( if ($source !== 'shadowing' && $language->getFilterCompilerFiles()) { $matchesExtension = false; foreach ($language->getExtensions() as $extension) { - $extensionWithDot = '.' . $extension; - $extensionLength = strlen($extensionWithDot); - if (substr($file->getClientOriginalName(), -$extensionLength) === $extensionWithDot) { + if (str_ends_with($file->getClientOriginalName(), '.' . $extension)) { $matchesExtension = true; break; }