1
0
mirror of https://github.com/guzzle/guzzle.git synced 2025-02-24 18:13:00 +01:00

Catching stream toString exceptions and throwing a fatal error instead

This commit is contained in:
Michael Dowling 2013-08-11 20:56:13 -07:00
parent e3a9545405
commit 11a7edb2e8

View File

@ -20,15 +20,19 @@ trait StreamDecorator
public function __toString()
{
$buffer = '';
if ($this->rewind()) {
while (!$this->eof()) {
$buffer .= $this->read(32768);
try {
$buffer = '';
if ($this->rewind()) {
while (!$this->eof()) {
$buffer .= $this->read(32768);
}
$this->rewind();
}
$this->rewind();
return $buffer;
} catch (\Exception $e) {
// Really, PHP? https://bugs.php.net/bug.php?id=53648
trigger_error((string) $e, E_USER_ERROR);
}
return $buffer;
}
/**