summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2014-04-02 10:55:50 +0200
committerVincent Petry <pvince81@owncloud.com>2014-04-02 10:55:50 +0200
commit4cc70ec39db3e7b07178a451ac56977b84564ca2 (patch)
treebd79663f73e01de8bb5ceaad20bce3d521ea02b3 /lib
parent73dd5ff26c2d7652fd4abacbac53d734f64fde96 (diff)
parent0067a4eac287928a70a50c925b00777d760e4ec1 (diff)
downloadnextcloud-server-4cc70ec39db3e7b07178a451ac56977b84564ca2.tar.gz
nextcloud-server-4cc70ec39db3e7b07178a451ac56977b84564ca2.zip
Merge pull request #7979 from owncloud/core-fixfilegetcontentsloop
Correctly read the full stream in file_get_contents
Diffstat (limited to 'lib')
-rw-r--r--lib/private/files/storage/common.php12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/private/files/storage/common.php b/lib/private/files/storage/common.php
index 2b697141515..0ce447a5a48 100644
--- a/lib/private/files/storage/common.php
+++ b/lib/private/files/storage/common.php
@@ -118,17 +118,17 @@ abstract class Common implements \OC\Files\Storage\Storage {
if (!$handle) {
return false;
}
- $size = $this->filesize($path);
- if ($size == 0) {
- return '';
- }
- return fread($handle, $size);
+ $data = stream_get_contents($handle);
+ fclose($handle);
+ return $data;
}
public function file_put_contents($path, $data) {
$handle = $this->fopen($path, "w");
$this->removeCachedFile($path);
- return fwrite($handle, $data);
+ $count = fwrite($handle, $data);
+ fclose($handle);
+ return $count;
}
public function rename($path1, $path2) {