Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
Merge branch 'hotfix/zendframework/zendframework#6537-support-mime-st…
Browse files Browse the repository at this point in the history
…ream-rewind'

Close zendframework/zendframework#6537
  • Loading branch information
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Part.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,14 @@ public function getEncodedStream($EOL = Mime::LINEEND)
public function getContent($EOL = Mime::LINEEND)
{
if ($this->isStream) {
$encodedStream = $this->getEncodedStream($EOL);
$encodedStream = $this->getEncodedStream($EOL);
$encodedStreamContents = stream_get_contents($encodedStream);
rewind($encodedStream);
$streamMetaData = stream_get_meta_data($encodedStream);

if (isset($streamMetaData['seekable']) && $streamMetaData['seekable']) {
rewind($encodedStream);
}

return $encodedStreamContents;
}
return Mime::encode($this->content, $this->encoding, $EOL);
Expand Down

0 comments on commit 62e7d61

Please sign in to comment.