Skip to content

Commit

Permalink
Work around issue with input streams (#354)
Browse files Browse the repository at this point in the history
  • Loading branch information
GrahamCampbell committed Mar 7, 2021
1 parent 2f3e4f6 commit 202292e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Utils.php
Expand Up @@ -306,6 +306,11 @@ public static function streamFor($resource = '', array $options = [])

switch (gettype($resource)) {
case 'resource':
if (\stream_get_meta_data($resource)['uri'] === 'php://input') {
$stream = fopen('php://temp', 'w+');
fwrite($stream, stream_get_contents($resource));
$resource = $stream;
}
return new Stream($resource, $options);
case 'object':
if ($resource instanceof StreamInterface) {
Expand Down

0 comments on commit 202292e

Please sign in to comment.