diff options
author | Lukas Reschke <lukas@owncloud.com> | 2014-11-17 22:39:40 +0100 |
---|---|---|
committer | Lukas Reschke <lukas@owncloud.com> | 2014-11-17 22:39:40 +0100 |
commit | 6535540dcda9d6d82d59c3c8523790a477d033b6 (patch) | |
tree | 414f75916379030b2fe66f273da34e04e08c4781 | |
parent | af7688ec17c260d3e227393e8e81438fe88b956c (diff) | |
download | nextcloud-server-6535540dcda9d6d82d59c3c8523790a477d033b6.tar.gz nextcloud-server-6535540dcda9d6d82d59c3c8523790a477d033b6.zip |
Check if the size field is available
In some cases the 'size' field is not available resulting in some PHP errors such as:
```json
{"reqId":"03548fd9e3d3aca15a5796b3b35d7b9d","remoteAddr":"::1","app":"PHP","message":"Undefined index: size at \/Users\/lreschke\/Programming\/core\/lib\/private\/files\/fileinfo.php#125","level":3,"time":"2014-11-17T21:38:57+00:00"}
```
This can be experienced when creating a new empty file and deleting it right away, then when going to the trash bin this error is thrown.
-rw-r--r-- | lib/private/files/fileinfo.php | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/private/files/fileinfo.php b/lib/private/files/fileinfo.php index 8457a2d160f..d6d6a245e44 100644 --- a/lib/private/files/fileinfo.php +++ b/lib/private/files/fileinfo.php @@ -122,7 +122,7 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess { * @return int */ public function getSize() { - return $this->data['size']; + return isset($this->data['size']) ? $this->data['size'] : 0; } /** |