From e45ecaa0cc539cd86fb10ca4ed0e7f1685220644 Mon Sep 17 00:00:00 2001 From: "Eloy Lafuente (stronk7)" Date: Fri, 14 Aug 2020 17:48:57 +0200 Subject: [PATCH] MDL-69477 install: Ensure CFG variables are set before using them On installation (or also phpunit/behat unit) some CFG variables were being used (on setting validation) before being set. So this commit just verifies they are set before using them. Note that, strictly speaking, only one of them ($CFG->searchenginequeryonly) required the extra check, but I think it's better to apply it to all them, as a reference and in case validations are run in any other order. --- admin/settings/plugins.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/admin/settings/plugins.php b/admin/settings/plugins.php index cc23ff3d015..3e7c68c6e50 100644 --- a/admin/settings/plugins.php +++ b/admin/settings/plugins.php @@ -555,7 +555,7 @@ if ($hassiteconfig) { global $CFG; // Check nobody's setting the indexing and query-only server to the same one. - if ($CFG->searchenginequeryonly === $value) { + if (isset($CFG->searchenginequeryonly) && $CFG->searchenginequeryonly === $value) { return get_string('searchenginequeryonlysame', 'admin'); } else { return ''; @@ -625,7 +625,7 @@ if ($hassiteconfig) { global $CFG; // Check nobody's setting the indexing and query-only server to the same one. - if ($CFG->searchengine === $value) { + if (isset($CFG->searchengine) && $CFG->searchengine === $value) { return get_string('searchenginequeryonlysame', 'admin'); } else { return '';