From 2c61186716df091a2d87ad784ece308d20f45bda Mon Sep 17 00:00:00 2001 From: meirzamoodle Date: Tue, 14 Jan 2025 16:09:30 +0700 Subject: [PATCH] MDL-83172 environment: Fix undefined array key error --- lib/environmentlib.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/environmentlib.php b/lib/environmentlib.php index 2dcd9fe4aa0..4abbdd82fe4 100644 --- a/lib/environmentlib.php +++ b/lib/environmentlib.php @@ -1053,15 +1053,16 @@ function environment_check_database($version, $env_select) { $dbinfo = $DB->get_server_info(); $current_version = normalize_version($dbinfo['version']); - $needed_version = $vendors[$current_vendor]; -/// Check we have a needed version - if (!$needed_version) { + // Check we have a needed version. + if (empty($vendors[$current_vendor])) { $result->setStatus(false); $result->setErrorCode(NO_DATABASE_VENDOR_VERSION_FOUND); return $result; } + $needed_version = $vendors[$current_vendor]; + // Check if the DB Vendor has been properly configured. // Hack: this is required when playing with MySQL and MariaDB since they share the same PHP module and base DB classes, // whilst they are slowly evolving using separate directions though MariaDB is still an "almost" drop-in replacement.