1
0
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:
Michael Dowling 2013-02-23 15:28:01 -08:00
parent ea2a6afbce
commit 47781a95b8

View File

@ -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);
}