From 99452cb4f3302c38f74874f35f066f15d7c63640 Mon Sep 17 00:00:00 2001 From: Sasha Anastasi Date: Thu, 20 Feb 2025 13:01:11 +1300 Subject: [PATCH 1/2] outagelib: adjust exception trigger for phpunit10 --- classes/local/outagelib.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/classes/local/outagelib.php b/classes/local/outagelib.php index 82cab6a..606296d 100644 --- a/classes/local/outagelib.php +++ b/classes/local/outagelib.php @@ -266,7 +266,9 @@ class outagelib { // Used to test the try block in case of errors. if (PHPUNIT_TEST && optional_param('auth_outage_break_code', false, PARAM_INT)) { - (new stdClass())->invalidfield; // Triggers an exception. + if (!isset($emptyvar)) { + throw new coding_exception('Empty variable "emptyvar" is empty'); + } } // Nothing preventing the injection. From b01dd8723e8e2917c250dda2c466b9a598f46381 Mon Sep 17 00:00:00 2001 From: Sasha Anastasi Date: Thu, 20 Feb 2025 14:17:15 +1300 Subject: [PATCH 2/2] remove superfluous conditional --- classes/local/outagelib.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/classes/local/outagelib.php b/classes/local/outagelib.php index 606296d..ffcc254 100644 --- a/classes/local/outagelib.php +++ b/classes/local/outagelib.php @@ -266,9 +266,7 @@ class outagelib { // Used to test the try block in case of errors. if (PHPUNIT_TEST && optional_param('auth_outage_break_code', false, PARAM_INT)) { - if (!isset($emptyvar)) { - throw new coding_exception('Empty variable "emptyvar" is empty'); - } + throw new coding_exception('Exception triggered'); } // Nothing preventing the injection.