From c71b90b2d658ab02d197a8a4a2c37b0501669378 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Mon, 18 Jul 2016 21:34:53 +0900 Subject: [PATCH] Fix error when writing an empty file --- common/framework/storage.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/common/framework/storage.php b/common/framework/storage.php index 88367e8bc..14ecce436 100644 --- a/common/framework/storage.php +++ b/common/framework/storage.php @@ -256,17 +256,17 @@ class Storage flock($fp, \LOCK_EX); if (is_resource($content)) { - $result = stream_copy_to_stream($content, $fp) ? true : false; + $result = stream_copy_to_stream($content, $fp); } else { - $result = fwrite($fp, $content) ? true : false; + $result = fwrite($fp, $content); } fflush($fp); flock($fp, \LOCK_UN); fclose($fp); - if (!$result) + if ($result === false) { trigger_error('Cannot write file: ' . (isset($original_filename) ? $original_filename : $filename), \E_USER_WARNING); return false; @@ -303,7 +303,7 @@ class Storage } clearstatcache(true, $filename); - return $result; + return true; } /**