Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove 32-bit workarounds #34907

Merged
merged 2 commits into from
Nov 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 1 addition & 14 deletions lib/private/Files/Storage/Local.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,6 @@ public function stat($path) {
return false;
}
$statResult = @stat($fullPath);
if (PHP_INT_SIZE === 4 && $statResult && !$this->is_dir($path)) {
$filesize = $this->filesize($path);
$statResult['size'] = $filesize;
$statResult[7] = $filesize;
}
if (is_array($statResult)) {
$statResult['full_path'] = $fullPath;
}
Expand Down Expand Up @@ -246,10 +241,6 @@ public function filesize($path) {
return 0;
}
$fullPath = $this->getSourcePath($path);
if (PHP_INT_SIZE === 4) {
$helper = new \OC\LargeFileHelper;
return $helper->getFileSize($fullPath);
}
return filesize($fullPath);
}

Expand All @@ -271,10 +262,6 @@ public function filemtime($path) {
if (!$this->file_exists($path)) {
return false;
}
if (PHP_INT_SIZE === 4) {
$helper = new \OC\LargeFileHelper();
return $helper->getFileMtime($fullPath);
}
return filemtime($fullPath);
}

Expand Down Expand Up @@ -421,7 +408,7 @@ public function free_space($path) {
if ($space === false || is_null($space)) {
return \OCP\Files\FileInfo::SPACE_UNKNOWN;
}
return $space;
return (int)$space;
}

public function search($query) {
Expand Down
7 changes: 3 additions & 4 deletions lib/private/Setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,14 +247,13 @@ public function getSystemInfo($allowAllDatabases = false) {
];
}

if ($this->iniWrapper->getString('open_basedir') !== '' && PHP_INT_SIZE === 4) {
if (PHP_INT_SIZE < 8) {
$errors[] = [
'error' => $this->l10n->t(
'It seems that this %s instance is running on a 32-bit PHP environment and the open_basedir has been configured in php.ini. ' .
'This will lead to problems with files over 4 GB and is highly discouraged.',
'It seems that this %s instance is running on a 32-bit PHP environment. 64-bit is required for 26 and higher.',
[$this->defaults->getProductName()]
),
'hint' => $this->l10n->t('Please remove the open_basedir setting within your php.ini or switch to 64-bit PHP.'),
'hint' => $this->l10n->t('Please switch to 64-bit PHP.'),
];
}

Expand Down
2 changes: 1 addition & 1 deletion lib/private/Streamer.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function __construct(IRequest $request, int $size, int $numberOfFiles) {
} elseif ($request->isUserAgent($this->preferTarFor)) {
$this->streamerInstance = new TarStreamer();
} else {
$this->streamerInstance = new ZipStreamer(['zip64' => PHP_INT_SIZE !== 4]);
$this->streamerInstance = new ZipStreamer(['zip64' => true]);
}
}

Expand Down
13 changes: 0 additions & 13 deletions lib/private/legacy/OC_Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,6 @@ public static function setContentDispositionHeader($filename, $type = 'attachmen
* @param string|int|float $length Length to be sent
*/
public static function setContentLengthHeader($length) {
if (PHP_INT_SIZE === 4) {
if ($length > PHP_INT_MAX && stripos(PHP_SAPI, 'apache') === 0) {
// Apache PHP SAPI casts Content-Length headers to PHP integers.
// This enforces a limit of PHP_INT_MAX (2147483647 on 32-bit
// platforms). So, if the length is greater than PHP_INT_MAX,
// we just do not send a Content-Length header to prevent
// bodies from being received incompletely.
return;
}
// Convert signed integer or float to unsigned base-10 string.
$lfh = new \OC\LargeFileHelper;
$length = $lfh->formatUnsignedInteger($length);
}
header('Content-Length: '.$length);
}

Expand Down