Skip to content

Commit

Permalink
Avoid no-url index in stream_get_meta_data (#413)
Browse files Browse the repository at this point in the history
* Avoid no-url index in stream_get_meta_data

* isset instead of check key is exists

Co-authored-by: b.stepanenko <b.stepanenko@densure.ru>
  • Loading branch information
bscheshirwork and b.stepanenko committed Apr 24, 2021
1 parent 359b1f4 commit b66d38d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Utils.php
Expand Up @@ -317,7 +317,8 @@ public static function streamFor($resource = '', array $options = [])
* The 'php://input' is a special stream with quirks and inconsistencies.
* We avoid using that stream by reading it into php://temp
*/
if (\stream_get_meta_data($resource)['uri'] === 'php://input') {
$metaData = \stream_get_meta_data($resource);
if (isset($metaData['uri']) && $metaData['uri'] === 'php://input') {
$stream = self::tryFopen('php://temp', 'w+');
fwrite($stream, stream_get_contents($resource));
fseek($stream, 0);
Expand Down

0 comments on commit b66d38d

Please sign in to comment.