From a1eb61f1027efa7703e2aec42bffc9a8c9112939 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cornelius=20Wei=C3=9F?= Date: Sun, 18 Nov 2007 20:04:58 +0000 Subject: [PATCH] fix for reading empty files. This caused problems with mac os x as WebDAV client --- phpgwapi/inc/class.vfs_sql.inc.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/phpgwapi/inc/class.vfs_sql.inc.php b/phpgwapi/inc/class.vfs_sql.inc.php index ea1b5d24c5..1f558a7c7c 100644 --- a/phpgwapi/inc/class.vfs_sql.inc.php +++ b/phpgwapi/inc/class.vfs_sql.inc.php @@ -771,7 +771,17 @@ { if (($fp = fopen ($p->real_full_path, 'rb'))) { - $contents = fread ($fp, filesize ($p->real_full_path)); + if (filesize($p->real_full_path) > 0) + { + $contents = fread ($fp, filesize($p->real_full_path)); + } + else + { + // files could also have no contents. In this case + // the second parameter should not be present! + $contents = fread ($fp); + } + fclose ($fp); } else