Skip to content

Commit e580f91

Browse files
authored
Merge pull request #23257 from aler9/patch-32bit-filesize-master
Fix file size computation on 32bit platforms
2 parents 32f6bdf + ac0c7a8 commit e580f91

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

lib/private/Files/Storage/Local.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,8 @@ public function is_file($path) {
146146
public function stat($path) {
147147
$fullPath = $this->getSourcePath($path);
148148
clearstatcache(true, $fullPath);
149-
$statResult = stat($fullPath);
150-
if (PHP_INT_SIZE === 4 && !$this->is_dir($path)) {
149+
$statResult = @stat($fullPath);
150+
if (PHP_INT_SIZE === 4 && $statResult && !$this->is_dir($path)) {
151151
$filesize = $this->filesize($path);
152152
$statResult['size'] = $filesize;
153153
$statResult[7] = $filesize;
@@ -159,9 +159,7 @@ public function stat($path) {
159159
* @inheritdoc
160160
*/
161161
public function getMetaData($path) {
162-
$fullPath = $this->getSourcePath($path);
163-
clearstatcache(true, $fullPath);
164-
$stat = @stat($fullPath);
162+
$stat = $this->stat($path);
165163
if (!$stat) {
166164
return null;
167165
}
@@ -180,6 +178,7 @@ public function getMetaData($path) {
180178
}
181179

182180
if (!($path === '' || $path === '/')) { // deletable depends on the parents unix permissions
181+
$fullPath = $this->getSourcePath($path);
183182
$parent = dirname($fullPath);
184183
if (is_writable($parent)) {
185184
$permissions += Constants::PERMISSION_DELETE;

0 commit comments

Comments
 (0)