From 710a2414d8c8f614b39c47df3d6634c46c6f3f40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Mudr=C3=A1k?= Date: Mon, 5 Jun 2017 20:50:28 +0200 Subject: [PATCH] MDL-53240 filetypes: Use multibyte safe variant of strtolower Credit goes to failed unit tests. --- lib/form/classes/filetypes_util.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/form/classes/filetypes_util.php b/lib/form/classes/filetypes_util.php index 51276edb56f..4eefc07f18e 100644 --- a/lib/form/classes/filetypes_util.php +++ b/lib/form/classes/filetypes_util.php @@ -26,6 +26,7 @@ namespace core_form; use core_collator; use core_filetypes; +use core_text; defined('MOODLE_INTERNAL') || die(); @@ -73,7 +74,7 @@ class filetypes_util { // Fix whitespace and normalize the syntax a bit. foreach ($types as $i => $type) { $type = str_replace('*.', '.', $type); - $type = strtolower($type); + $type = core_text::strtolower($type); $type = trim($type); if ($type === '*') { @@ -470,7 +471,7 @@ class filetypes_util { return true; } - $haystack = strrev(trim(strtolower($filename))); + $haystack = strrev(trim(core_text::strtolower($filename))); foreach ($allowedextensions as $extension) { if (strpos($haystack, strrev($extension)) === 0) {