Skip to content

Commit

Permalink
Fix issue reading from large streams
Browse files Browse the repository at this point in the history
PregReplaceFilterStream didn't implement eof(), which caused an
issue using stream_get_contents on a guzzle resource created out
of the stream

zbateson/mail-mime-parser#84
zbateson/mail-mime-parser#87
  • Loading branch information
zbateson committed Mar 21, 2019
1 parent af46847 commit ec3c3ea
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/PregReplaceFilterStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@ public function __construct(StreamInterface $stream, $pattern, $replacement)
$this->buffer = new BufferStream();
}

/**
* Returns true if the end of stream has been reached.
*
* @return boolean
*/
public function eof()
{
return ($this->buffer->eof() && $this->stream->eof());
}

/**
* Not supported by PregReplaceFilterStream
*
Expand Down

0 comments on commit ec3c3ea

Please sign in to comment.