]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix file_get_content on empty files for filestorage common
authorRobin Appelman <icewind@owncloud.com>
Fri, 2 Mar 2012 23:55:17 +0000 (00:55 +0100)
committerRobin Appelman <icewind@owncloud.com>
Fri, 2 Mar 2012 23:57:52 +0000 (00:57 +0100)
lib/filestorage/common.php

index fa0e7babf5647344e782a11037a114ae11f686f8..ed12e67eeb3eb904d54f4bc4ae635710e01dff1c 100644 (file)
@@ -59,7 +59,14 @@ abstract class OC_Filestorage_Common extends OC_Filestorage {
        }
        public function file_get_contents($path) {
                $handle = $this->fopen($path, "r");
-               return fread($handle, $this->filesize($path));
+               if(!$handle){
+                       return false;
+               }
+               $size=$this->filesize($path);
+               if($size==0){
+                       return '';
+               }
+               return fread($handle, $size);
        }
        public function file_put_contents($path,$data) {
                $handle = $this->fopen($path, "w");