mirror of
https://github.com/guzzle/guzzle.git
synced 2025-02-25 18:43:22 +01:00
Only doing fwrite and rewind in stream factory when data is present
This commit is contained in:
parent
ea2a6afbce
commit
47781a95b8
@ -85,8 +85,10 @@ class EntityBody extends Stream implements EntityBodyInterface
|
||||
public static function fromString($string)
|
||||
{
|
||||
$stream = fopen('php://temp', 'r+');
|
||||
fwrite($stream, $string);
|
||||
rewind($stream);
|
||||
if ($string !== '') {
|
||||
fwrite($stream, $string);
|
||||
rewind($stream);
|
||||
}
|
||||
|
||||
return new static($stream);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user