Skip to content
Snippets Groups Projects
Commit 1117583b authored by Markus Klein's avatar Markus Klein Committed by Frank Naegler
Browse files

[BUGFIX] Ensure correct return type for AbstractFile getters

Resolves: #76212
Releases: master, 7.6
Change-Id: I7b7ded93ff1d31f00f8d067f9697cd8f71305881
Reviewed-on: https://review.typo3.org/48195


Reviewed-by: default avatarMichael Oehlhof <typo3@oehlhof.de>
Reviewed-by: default avatarWouter Wolters <typo3@wouterwolters.nl>
Tested-by: default avatarWouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: default avatarFrank Naegler <frank.naegler@typo3.org>
Tested-by: default avatarFrank Naegler <frank.naegler@typo3.org>
parent 331c6c79
Branches
Tags
No related merge requests found
......@@ -183,14 +183,19 @@ abstract class AbstractFile implements FileInterface
* Returns the size of this file
*
* @throws \RuntimeException
* @return int
* @return int|null Returns null if size is not available for the file
*/
public function getSize()
{
if ($this->deleted) {
throw new \RuntimeException('File has been deleted.', 1329821480);
}
return $this->properties['size'] ?: array_pop($this->getStorage()->getFileInfoByIdentifier($this->getIdentifier(), array('size')));
if (empty($this->properties['size'])) {
$size = array_pop($this->getStorage()->getFileInfoByIdentifier($this->getIdentifier(), array('size')));
} else {
$size = $this->properties['size'];
}
return $size ? (int)$size : null;
}
/**
......@@ -200,7 +205,7 @@ abstract class AbstractFile implements FileInterface
*/
public function getUid()
{
return $this->getProperty('uid');
return (int)$this->getProperty('uid');
}
/**
......@@ -228,7 +233,7 @@ abstract class AbstractFile implements FileInterface
if ($this->deleted) {
throw new \RuntimeException('File has been deleted.', 1329821487);
}
return $this->getProperty('creation_date');
return (int)$this->getProperty('creation_date');
}
/**
......@@ -242,7 +247,7 @@ abstract class AbstractFile implements FileInterface
if ($this->deleted) {
throw new \RuntimeException('File has been deleted.', 1329821488);
}
return $this->getProperty('modification_date');
return (int)$this->getProperty('modification_date');
}
/**
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment