Skip to content

Commit

Permalink
Return null in caching stream size if remote is null (guzzle#438)
Browse files Browse the repository at this point in the history
* Return null in caching stream size if remote is null

* Added test coverage

* Fixed typo

* Fixes
  • Loading branch information
GrahamCampbell authored and JanMikes committed Jan 27, 2022
1 parent c793ad3 commit 3890fea
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/CachingStream.php
Expand Up @@ -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
Expand Down

0 comments on commit 3890fea

Please sign in to comment.