Skip to content

Commit

Permalink
[BUGFIX] Adjust EmailFinisher to new recipient style
Browse files Browse the repository at this point in the history
With the symfony mail component recipient addresses should be
instantiated and used as either `Address` or `NamedAddress` object
instead of an associative array. The patch introduces usage of both.

Resolves: #88702
Releases: master
Change-Id: Ie592d93c6cc191da873478e59830900a66ea9aeb
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/61237
Tested-by: Benjamin Franzke <bfr@qbus.de>
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Benni Mack <benni@typo3.org>
Reviewed-by: Benjamin Franzke <bfr@qbus.de>
Reviewed-by: Benni Mack <benni@typo3.org>
  • Loading branch information
susannemoog authored and bmack committed Jul 9, 2019
1 parent 594f599 commit 7d5d378
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions typo3/sysext/form/Classes/Domain/Finishers/EmailFinisher.php
Expand Up @@ -272,16 +272,19 @@ protected function getRecipients(
$recipients[$singleAddress] = $singleAddressName ?: '';
}

// Drop entries without mail address
$recipients = array_filter($recipients, function ($value, $key) {
if (MathUtility::canBeInterpretedAsInteger($key)) {
return !empty($value);
$addresses = [];
foreach ($recipients as $address => $name) {
if (MathUtility::canBeInterpretedAsInteger($address)) {
$address = $name;
$name = '';
}

return !empty($key);
}, ARRAY_FILTER_USE_BOTH);

return $recipients;
// Drop entries without mail address
if (empty($address)) {
continue;
}
$addresses[] = new NamedAddress($address, $name);
}
return $addresses;
}

/**
Expand Down

0 comments on commit 7d5d378

Please sign in to comment.