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:
parent
e3a9545405
commit
11a7edb2e8
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user