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.
This commit is contained in:
MDW 2024-02-20 12:29:41 +01:00 committed by GitHub
parent f0ffe83fe6
commit b3702b2467
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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;