Silence warning about "Invalid argument supplied for foreach()" in a way that still works with reference

This commit is contained in:
nathangray 2018-12-18 11:19:13 -07:00
parent d40a282f0d
commit 996ce52b1a

View File

@ -1368,7 +1368,9 @@ class mail_compose
}
// set filemode icons for all attachments
foreach((array)$content['attachments'] as &$attach)
if($content['attachments'] && is_array($content['attachments']))
{
foreach($content['attachments'] as &$attach)
{
$attach['is_dir'] = is_dir($attach['file']);
$attach['filemode_icon'] = !is_dir($attach['file']) &&
@ -1376,6 +1378,7 @@ class mail_compose
? Vfs\Sharing::LINK : $content['filemode'];
$attach['filemode_title'] = lang(Vfs\Sharing::$modes[$attach['filemode_icon']]['label']);
}
}
$content['to'] = self::resolveEmailAddressList($content['to']);
//error_log(__METHOD__.__LINE__.array2string($content));