Skip to content

Commit c8051a5

Browse files
committed
Missing variable check added to prevent content-type parsing error Webklex#356
Webklex/laravel-imap#356
1 parent 0e5e6f2 commit c8051a5

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/Part.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,6 @@ protected function parse(){
166166
$body = $this->raw;
167167
}
168168

169-
$this->subtype = $this->parseSubtype($this->header->get("content-type"));
170169
$this->parseDisposition();
171170
$this->parseDescription();
172171
$this->parseEncoding();
@@ -186,10 +185,15 @@ protected function parse(){
186185
]);
187186
}
188187

189-
if(!empty($this->header->get("content-type"))){
190-
$rawContentType = $this->header->get("content-type");
191-
$contentTypeArray = explode(';', $rawContentType);
192-
$this->content_type = trim($contentTypeArray[0]);
188+
$content_types = $this->header->get("content-type");
189+
if(!empty($content_types)){
190+
$this->subtype = $this->parseSubtype($content_types);
191+
$content_type = $content_types;
192+
if (is_array($content_types)) {
193+
$content_type = $content_types[0];
194+
}
195+
$parts = explode(';', $content_type);
196+
$this->content_type = trim($parts[0]);
193197
}
194198

195199

0 commit comments

Comments
 (0)