Skip to content

Commit

Permalink
Merge pull request #247 from guzzle/fix-input-stream-subsequent-read
Browse files Browse the repository at this point in the history
Fix subsequent reads from php://input in ServerRequest
  • Loading branch information
sagikazarmark committed Feb 20, 2019
2 parents a5bf378 + d3dfe3d commit 31ea59d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/ServerRequest.php
Expand Up @@ -168,7 +168,7 @@ public static function fromGlobals()
$method = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : 'GET';
$headers = getallheaders();
$uri = self::getUriFromGlobals();
$body = new LazyOpenStream('php://input', 'r+');
$body = new CachingStream(new LazyOpenStream('php://input', 'r+'));
$protocol = isset($_SERVER['SERVER_PROTOCOL']) ? str_replace('HTTP/', '', $_SERVER['SERVER_PROTOCOL']) : '1.1';

$serverRequest = new ServerRequest($method, $uri, $headers, $body, $protocol, $_SERVER);
Expand Down

0 comments on commit 31ea59d

Please sign in to comment.