MDL-74408 core: exclude empty patterns in divert email config.

This commit is contained in:
Paul Holden
2022-06-09 09:39:17 +01:00
parent 5500d143f4
commit d91df53d63
2 changed files with 17 additions and 1 deletions
+1 -1
View File
@@ -5874,7 +5874,7 @@ function email_should_be_diverted($email) {
return true;
}
$patterns = array_map('trim', preg_split("/[\s,]+/", $CFG->divertallemailsexcept));
$patterns = array_map('trim', preg_split("/[\s,]+/", $CFG->divertallemailsexcept, -1, PREG_SPLIT_NO_EMPTY));
foreach ($patterns as $pattern) {
if (preg_match("/$pattern/", $email)) {
return false;
+16
View File
@@ -3408,6 +3408,22 @@ EOF;
),
true,
),
'alsodivertsblankline' => array(
'divertallemailsto' => '[email protected]',
'divertallemailsexcept' => "@dev.com\n",
[
'[email protected]',
],
true,
),
'divertsexceptionblankline' => array(
'divertallemailsto' => '[email protected]',
'divertallemailsexcept' => "@example.com\n",
[
'[email protected]',
],
false,
),
);
}