diff --git a/lib/private/Files/FileInfo.php b/lib/private/Files/FileInfo.php index 3ad2932e597b1..8e968ca453de6 100644 --- a/lib/private/Files/FileInfo.php +++ b/lib/private/Files/FileInfo.php @@ -148,10 +148,12 @@ public function getInternalPath() { } /** - * @return int + * Get FileInfo ID or null in case of part file + * + * @return int|null */ public function getId() { - return $this->data['fileid']; + return isset($this->data['fileid']) ? (int) $this->data['fileid'] : null; } /** @@ -193,7 +195,7 @@ public function getEtag() { */ public function getSize() { $this->updateEntryfromSubMounts(); - return isset($this->data['size']) ? $this->data['size'] : 0; + return isset($this->data['size']) ? (int) $this->data['size'] : 0; } /** @@ -201,7 +203,7 @@ public function getSize() { */ public function getMTime() { $this->updateEntryfromSubMounts(); - return $this->data['mtime']; + return (int) $this->data['mtime']; } /** @@ -224,11 +226,11 @@ public function getEncryptedVersion() { * @return int */ public function getPermissions() { - $perms = $this->data['permissions']; + $perms = (int) $this->data['permissions']; if (\OCP\Util::isSharingDisabledForUser() || ($this->isShared() && !\OC\Share\Share::isResharingAllowed())) { $perms = $perms & ~\OCP\Constants::PERMISSION_SHARE; } - return $perms; + return (int) $perms; } /** diff --git a/lib/public/Files/FileInfo.php b/lib/public/Files/FileInfo.php index 8eeb8df08ce0f..f0f21087bbe3b 100644 --- a/lib/public/Files/FileInfo.php +++ b/lib/public/Files/FileInfo.php @@ -144,7 +144,7 @@ public function getStorage(); /** * Get the file id of the file or folder * - * @return int + * @return int|null * @since 7.0.0 */ public function getId();