Added error handling to $parts array iteration

Signed-off-by: Janos SUTO <sj@acts.hu>
This commit is contained in:
Janos SUTO 2023-09-27 18:51:26 +02:00
parent 553ebb4f95
commit 1ca4d3b8c3

View File

@ -180,17 +180,19 @@ class ModelSearchMessage extends Model {
'text/html' => '' 'text/html' => ''
); );
for($i=0; $i<count($parts); $i++) { if(is_array($parts)) {
for($i=0; $i<count($parts); $i++) {
$body = Piler_Mime_Decode::fixMimeBodyPart($parts[$i]['headers'], $parts[$i]['body']);
$body = Piler_Mime_Decode::fixMimeBodyPart($parts[$i]['headers'], $parts[$i]['body']); if($parts[$i]['headers']['content-type']['type'] == 'text/html') {
$this->message['text/html'] .= $purifier->purify($body);
if($parts[$i]['headers']['content-type']['type'] == 'text/html') { }
$this->message['text/html'] .= $purifier->purify($body); else {
$this->message['text/plain'] .= $body;
}
} }
else { } else {
$this->message['text/plain'] .= $body; $this->message_array[CONST_TEXTPLAIN] = 'EMPTY_MESSAGE_BODY';
}
} }
return array('from' => $from, return array('from' => $from,