From 65f99764782f4e191ec311529d3ab0c7c2095a1f Mon Sep 17 00:00:00 2001 From: Paul Holden Date: Wed, 2 Feb 2022 17:33:39 +0000 Subject: [PATCH] MDL-73030 backup: case-insensitive detection of Moodle backups. --- backup/util/helper/convert_helper.class.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/backup/util/helper/convert_helper.class.php b/backup/util/helper/convert_helper.class.php index 98e1ed0eafa..a2d16b6e553 100644 --- a/backup/util/helper/convert_helper.class.php +++ b/backup/util/helper/convert_helper.class.php @@ -145,9 +145,11 @@ abstract class convert_helper { $firstchars = fread($handle, 200); $status = fclose($handle); - if (strpos($firstchars,'') !== false and - strpos($firstchars,'') !== false and - strpos($firstchars,'') !== false) { + // Look for expected XML elements (case-insensitive to account for encoding attribute). + if (stripos($firstchars, '') !== false && + strpos($firstchars, '') !== false && + strpos($firstchars, '') !== false) { + return true; }