Skip to content

Commit a2b5cfb

Browse files
authored
Make sure __toString does not throw exception (#28)
* Make sure __toString does not throw exception * Bugfix
1 parent 7459b39 commit a2b5cfb

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Stream.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,11 @@ public function __construct($socket, $size = null)
5959
*/
6060
public function __toString()
6161
{
62-
return (string) $this->getContents();
62+
try {
63+
return $this->getContents();
64+
} catch (\Exception $e) {
65+
return '';
66+
}
6367
}
6468

6569
/**

0 commit comments

Comments
 (0)