When a File input has “Multiple” enabled (name=“file-attachment[]”) and the Email action attaches it via an attachment of type “Form Data”, submitting the form fails with:
Email Action : preg_match(): Argument #2 ($subject) must be of type
string, array given
No email is sent.
Cause: extension/Actions/EmailAction.php, render(), branch type === ‘form’:
named_tmp_file($_FILES[$key][‘tmp_name’], $_FILES[$key][‘name’]) assumes a single file. With a multiple input both values are arrays, and sanitize_file_name() fails on the name array.
Expected: every uploaded file is attached. Suggested fix: loop over the arrays and call named_tmp_file() per file (skip entries with an upload error).
