Skip to content

Commit

Permalink
Robust getStreamSize
Browse files Browse the repository at this point in the history
  • Loading branch information
GrahamCampbell authored and frankdejonge committed Dec 29, 2019
1 parent 421df6d commit 7baf659
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,10 @@ public static function getStreamSize($resource)
{
$stat = fstat($resource);

if ( ! is_array($stat) || ! isset($stat['size'])) {
throw new RuntimeException('Cannot stat resource. Remote files are not supported.');
}

return $stat['size'];
}

Expand Down

0 comments on commit 7baf659

Please sign in to comment.