From 009e0086776afb7e46c300000ad0e51d912c2048 Mon Sep 17 00:00:00 2001 From: Quentin Gabriele Date: Sat, 27 Jul 2024 13:54:18 +0200 Subject: [PATCH] close stream if required --- src/MediaCollection.php | 3 ++- src/MediaZipper.php | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/MediaCollection.php b/src/MediaCollection.php index 2ee61be..cbff933 100644 --- a/src/MediaCollection.php +++ b/src/MediaCollection.php @@ -18,5 +18,6 @@ public function __construct( public bool $public = false, public ?string $disk = null, public null|string|Closure $fallback = null, - ) {} + ) { + } } diff --git a/src/MediaZipper.php b/src/MediaZipper.php index 70441fa..5b78cc6 100644 --- a/src/MediaZipper.php +++ b/src/MediaZipper.php @@ -38,7 +38,9 @@ public function toFile(Filesystem $storage, string $path, array $options = []): $success = $storage->writeStream($path, $temporaryStream, $options); - fclose($temporaryStream); + if (is_resource($temporaryStream)) { + fclose($temporaryStream); + } return $success ? $path : false; }