From: Thomas Müller Date: Thu, 2 Apr 2015 14:18:10 +0000 (+0200) Subject: Using stream_get_contents in file_get_contents implementation + close handle X-Git-Tag: v8.1.0alpha1~78^2~17 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=8991272269632bc094fb8ad537d5af5a1bc372b5;p=nextcloud-server.git Using stream_get_contents in file_get_contents implementation + close handle --- diff --git a/lib/private/files/storage/wrapper/encryption.php b/lib/private/files/storage/wrapper/encryption.php index 58d963613aa..3ea3b987d4c 100644 --- a/lib/private/files/storage/wrapper/encryption.php +++ b/lib/private/files/storage/wrapper/encryption.php @@ -112,23 +112,18 @@ class Encryption extends Wrapper { */ public function file_get_contents($path) { - $data = null; $encryptionModule = $this->getEncryptionModule($path); if ($encryptionModule) { - - $handle = $this->fopen($path, 'r'); - - if (is_resource($handle)) { - while (!feof($handle)) { - $data .= fread($handle, $this->util->getBlockSize()); - } + $handle = $this->fopen($path, "r"); + if (!$handle) { + return false; } - } else { - $data = $this->storage->file_get_contents($path); + $data = stream_get_contents($handle); + fclose($handle); + return $data; } - - return $data; + return $this->storage->file_get_contents($path); } /**