summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2015-04-02 16:18:10 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2015-04-07 13:30:31 +0200
commit8991272269632bc094fb8ad537d5af5a1bc372b5 (patch)
tree20416e59486ce8d3f709596d603b0895ff2e4836
parentff16e3dbff4031bd1d3e7340ac0b53f22c60ac44 (diff)
downloadnextcloud-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.php19
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);
}
/**