From b66d38dbfea87d53c89421b2883f44632099fbb5 Mon Sep 17 00:00:00 2001 From: bscheshirwork Date: Sat, 24 Apr 2021 21:16:41 +0300 Subject: [PATCH] Avoid no-url index in stream_get_meta_data (#413) * Avoid no-url index in stream_get_meta_data * isset instead of check key is exists Co-authored-by: b.stepanenko --- src/Utils.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Utils.php b/src/Utils.php index f4e48640..6b6c8cce 100644 --- a/src/Utils.php +++ b/src/Utils.php @@ -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);