Skip to content

Commit 1774dbb

Browse files
committed
Prevent the structure parsing from parsing an empty part
1 parent a965080 commit 1774dbb

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

src/Structure.php

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public function findContentType(): void {
9595
}
9696

9797
/**
98-
* Find all available headers and return the left over body segment
98+
* Find all available headers and return the leftover body segment
9999
* @var string $context
100100
* @var integer $part_number
101101
*
@@ -131,7 +131,7 @@ private function detectParts(string $boundary, string $context, int $part_number
131131
$final_parts = [];
132132
foreach($base_parts as $ctx) {
133133
$ctx = substr($ctx, 2);
134-
if ($ctx !== "--" && $ctx != "") {
134+
if ($ctx !== "--" && $ctx != "" && $ctx != "\r\n") {
135135
$parts = $this->parsePart($ctx, $part_number);
136136
foreach ($parts as $part) {
137137
$final_parts[] = $part;
@@ -161,14 +161,4 @@ public function find_parts(): array {
161161

162162
return [new Part($this->raw, $this->header)];
163163
}
164-
165-
/**
166-
* Try to find a boundary if possible
167-
*
168-
* @return string|null
169-
* @Depricated since version 2.4.4
170-
*/
171-
public function getBoundary(){
172-
return $this->header->getBoundary();
173-
}
174164
}

0 commit comments

Comments
 (0)