From 14c97f7b62648ea0d1732c569031460c19b6e747 Mon Sep 17 00:00:00 2001 From: nupplaPhil Date: Fri, 17 Jan 2020 20:45:21 +0100 Subject: [PATCH] avoid exception throwing because of false-like return --- src/Model/Storage/Filesystem.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Model/Storage/Filesystem.php b/src/Model/Storage/Filesystem.php index 9c429cfb3..f45e1db44 100644 --- a/src/Model/Storage/Filesystem.php +++ b/src/Model/Storage/Filesystem.php @@ -125,7 +125,10 @@ class Filesystem extends AbstractStorage $this->createFoldersForFile($file); - if (!file_put_contents($file, $data)) { + $result = file_put_contents($file, $data); + + // just in case the result is REALLY false, not zero or empty or anything else, throw the exception + if ($result === false) { $this->logger->warning('Failed to write data.', ['file' => $file]); throw new StorageException($this->l10n->t('Filesystem storage failed to save data to "%s". Check your write permissions', $file)); }