From e471c37b9b8f9a45f59a1eb5acd40bf1f6cc9231 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 9 Apr 2020 14:37:01 +0200 Subject: [PATCH] harden seekable http stream a bit against failures Signed-off-by: Robin Appelman --- lib/private/Files/Stream/SeekableHttpStream.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/lib/private/Files/Stream/SeekableHttpStream.php b/lib/private/Files/Stream/SeekableHttpStream.php index fdcd9ea8cfb..113ba19a17a 100644 --- a/lib/private/Files/Stream/SeekableHttpStream.php +++ b/lib/private/Files/Stream/SeekableHttpStream.php @@ -149,15 +149,25 @@ class SeekableHttpStream implements File { } public function stream_stat() { - return fstat($this->current); + if (is_resource($this->current)) { + return fstat($this->current); + } else { + return false; + } } public function stream_eof() { - return feof($this->current); + if (is_resource($this->current)) { + return feof($this->current); + } else { + return true; + } } public function stream_close() { - fclose($this->current); + if (is_resource($this->current)) { + fclose($this->current); + } } public function stream_write($data) { -- 2.39.5