From da0bebc9ae1065640bd1fe1c638012f3ee84b191 Mon Sep 17 00:00:00 2001 From: MDW Date: Wed, 10 Jan 2024 16:56:40 +0100 Subject: [PATCH] Fix: formmail - add_attached_files - argument name consistency (#27338) # Fix: formmail - add_attached_files - argument name consistency Phan determined suspicious naming as arg #2 to add_attached_files is while that was the name for the first argument by the caller. Also, on examination, only the first parameter is needed as add_attached_files handles the other two in the same manner. --- htdocs/core/class/html.formmail.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 59effb1deac..739223a5c66 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -440,9 +440,9 @@ class FormMail extends Form if (GETPOST('mode', 'alpha') == 'init' || (GETPOST('modelselected') && GETPOST('modelmailselected', 'alpha') && GETPOST('modelmailselected', 'alpha') != '-1')) { if (!empty($arraydefaultmessage->joinfiles) && !empty($this->param['fileinit']) && is_array($this->param['fileinit'])) { - foreach ($this->param['fileinit'] as $file) { - if (!empty($file)) { - $this->add_attached_files($file, basename($file), dol_mimetype($file)); + foreach ($this->param['fileinit'] as $path) { + if (!empty($path)) { + $this->add_attached_files($path); } } }