From dd6cb67030a260c94ec00770c966bc66dc24a308 Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Thu, 15 Oct 2015 12:12:52 +0200 Subject: [PATCH] check if fopen was successful before continue --- lib/private/files/storage/wrapper/encryption.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/private/files/storage/wrapper/encryption.php b/lib/private/files/storage/wrapper/encryption.php index aade7cd8bb1..2f0c1e35b04 100644 --- a/lib/private/files/storage/wrapper/encryption.php +++ b/lib/private/files/storage/wrapper/encryption.php @@ -195,9 +195,13 @@ class Encryption extends Wrapper { public function file_put_contents($path, $data) { // file put content will always be translated to a stream write $handle = $this->fopen($path, 'w'); - $written = fwrite($handle, $data); - fclose($handle); - return $written; + if (is_resource($handle)) { + $written = fwrite($handle, $data); + fclose($handle); + return $written; + } + + return false; } /**