From 3890fea7c4426fa31acbf8b7db88584162e5f707 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Mon, 4 Oct 2021 05:32:41 +0100 Subject: [PATCH] Return null in caching stream size if remote is null (#438) * Return null in caching stream size if remote is null * Added test coverage * Fixed typo * Fixes --- src/CachingStream.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/CachingStream.php b/src/CachingStream.php index 2c1d65c5..7a70ee94 100644 --- a/src/CachingStream.php +++ b/src/CachingStream.php @@ -36,7 +36,13 @@ public function __construct( public function getSize(): ?int { - return max($this->stream->getSize(), $this->remoteStream->getSize()); + $remoteSize = $this->remoteStream->getSize(); + + if (null === $remoteSize) { + return null; + } + + return max($this->stream->getSize(), $remoteSize); } public function rewind(): void