diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2015-04-02 16:18:10 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2015-04-07 13:30:31 +0200 |
commit | 8991272269632bc094fb8ad537d5af5a1bc372b5 (patch) | |
tree | 20416e59486ce8d3f709596d603b0895ff2e4836 | |
parent | ff16e3dbff4031bd1d3e7340ac0b53f22c60ac44 (diff) | |
download | nextcloud-server-8991272269632bc094fb8ad537d5af5a1bc372b5.tar.gz nextcloud-server-8991272269632bc094fb8ad537d5af5a1bc372b5.zip |
Using stream_get_contents in file_get_contents implementation + close handle
-rw-r--r-- | lib/private/files/storage/wrapper/encryption.php | 19 |
1 files changed, 7 insertions, 12 deletions
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); } /** |