From b3702b24677bc00e352085871512def915d827a5 Mon Sep 17 00:00:00 2001 From: MDW Date: Tue, 20 Feb 2024 12:29:41 +0100 Subject: [PATCH] Fix: Do not use exit in Testcase environment (#28301) # Fix: Do not use exit in Testcase environment Let tests continue in test case environment and allow identifying the cause for what would be an exit in a production setup. --- htdocs/main.inc.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index bf643ece410..65a2f37ca33 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -257,6 +257,11 @@ function analyseVarsForSqlAndScriptsInjection(&$var, $type, $stopcode = 1) // Note: No addition into security audit table is done because we don't want to execute code in such a case. // Detection of too many such requests can be done with a fail2ban rule on 403 error code or into the PHP server error log. + + if (class_exists('PHPUnit\Framework\TestSuite')) { + $message = $errormessage.' '.substr($errormessage2, 2000); + throw new Exception("Security injection exception: $message"); + } exit; } else { return false;