fix PHP 8.0 TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given

This commit is contained in:
Ralf Becker 2021-11-05 15:18:57 +01:00
parent 94ae9e2d0d
commit ff68c12773

View File

@ -5062,7 +5062,7 @@ class Mail
static function &getdisplayableBody(&$mailClass, $bodyParts, $preserveHTML = false, $useTidy = true) static function &getdisplayableBody(&$mailClass, $bodyParts, $preserveHTML = false, $useTidy = true)
{ {
$message=''; $message='';
for($i=0, $cnt=count($bodyParts); $i < $cnt; $i++) for($i=0, $cnt=count($bodyParts ?? []); $i < $cnt; $i++)
{ {
if (!isset($bodyParts[$i]['body'])) { if (!isset($bodyParts[$i]['body'])) {
$bodyParts[$i]['body'] = self::getdisplayableBody($mailClass, $bodyParts[$i], $preserveHTML, $useTidy); $bodyParts[$i]['body'] = self::getdisplayableBody($mailClass, $bodyParts[$i], $preserveHTML, $useTidy);