Stream checks isSeeakable before calling rewind in __toString

This commit is contained in:
PJ Dietz 2015-05-17 16:29:49 -04:00
parent 15da2ab805
commit b06abc0df2
1 changed files with 3 additions and 1 deletions

View File

@ -48,7 +48,9 @@ class Stream implements StreamInterface
{ {
$string = ""; $string = "";
try { try {
rewind($this->resource); if ($this->isSeekable()) {
rewind($this->resource);
}
$string = $this->getContents(); $string = $this->getContents();
} catch (\Exception $e) { } catch (\Exception $e) {
// Silence exceptions in order to conform with PHP's string casting operations. // Silence exceptions in order to conform with PHP's string casting operations.