From 43fceaf468f19e9714bbf296da4c611c68357301 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 4 Jan 2024 11:47:43 +0100 Subject: [PATCH 1/2] fix: pregmatch all always return empty array, muxt be tested like in findHtmlImages --- htdocs/core/class/CMailFile.class.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 7b0af81a62c..c801af3ad10 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -1752,14 +1752,13 @@ class CMailFile { // Build the array of image extensions $extensions = array_keys($this->image_types); - // We search (into mail body this->html), if we find some strings like "... file=xxx.img" // For example when: // $matches = array(); preg_match_all('/(?:"|\')([^"\']+\.('.implode('|', $extensions).'))(?:"|\')/Ui', $this->html, $matches); // If "xxx.ext" or 'xxx.ext' found - if (!empty($matches)) { + if (!empty($matches) && !empty($matches[1])) { $i = 0; // We are interested in $matches[1] only (the second set of parenthesis into regex) foreach ($matches[1] as $full) { @@ -1790,7 +1789,6 @@ class CMailFile $i++; } } - if (!empty($this->html_images)) { $inline = array(); From 053e0981adde798960c93bfebd48d225a681d964 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 4 Jan 2024 11:49:10 +0100 Subject: [PATCH 2/2] fix: pregmatch all always return empty array, muxt be tested like in findHtmlImages --- htdocs/core/class/CMailFile.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index c801af3ad10..da861fbfb0d 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -1752,6 +1752,7 @@ class CMailFile { // Build the array of image extensions $extensions = array_keys($this->image_types); + // We search (into mail body this->html), if we find some strings like "... file=xxx.img" // For example when: // @@ -1789,6 +1790,7 @@ class CMailFile $i++; } } + if (!empty($this->html_images)) { $inline = array();