-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
TypeError: Argument 2 passed to OC\Streamer::__construct() must be of the type integer, float given, called in /config/www/nextcloud/lib/private/legacy/files.php on line 166 #15117
Comments
Same behaviour on my system. Try download a directory greater then (approx) 1GB will result in an error. System Log
|
Same behaviour on my system too. Happens if I want to download more than 2 GB per download with multiple files. Download a single file with a big size is no problem. I tried it with 42 GB. System Log
GET /index.php/apps/files/ajax/download.php?dir=%2FUniversit%C3%A4t%2FBachelor%2F5.%20Semester%20(WS%202018-19)&files=IT-Management%20(Ahlemann)&downloadStartSecret=he6g716gbob |
Exact same thing happens to me too. Nextcloud 16.0.5 SNAP |
Same issue observed. SystemNextcloud
Database :
Log
|
I have a similar error when sharing a folder that contains eight 2 GB files and one 882 MB files. Nextcloud: Error Log(paths and adresses censored for privacy reasons)
|
Same occured: System |
I have the same issue. Is there any workaround or patch for this yet ? System |
File uploading/downloading is broken in both directions for me and generally always has been for anything over a GB. Running nextcloud on a Pi 4, on a docker with PHP limits set to 20Gb and 4Gb of RAM and swap. |
Same issue: NextCloudPi version | v1.28.1 |
Same issue when trying to download >2GB folders with .zip generation |
The fix seems to be a one-liner basically: In lib/private/Streamer.php exchange public function __construct(IRequest $request, float $size, int $numberOfFiles) (line 56 in Nextcloud 19.0.3). Didn't test that in depth, but at least got rid of the error message. The reason most likely is that PHP implicitely converts int to float as soon as a number overflow is about to occur. See https://www.php.net/manual/de/language.types.integer.php |
Hit by the same issue on Nextcloud 20.0.2.2 and PHP 7.4 (Ubuntu 20.04). @Wolfgang1966 your fix works on my side, thank you very much for sharing that. |
Please be aware that the fix improves the situation for sizes between 2GB and 4 GB. Above that it will result in corrupted ZIPs. So now I patched the constructor this way:
Above 4GB it will always create a tar archive. It may be less comfortable on Windows, but at least the archive is valid and there are enough tools out there which are able to handle them. |
@Wolfgang1966 Thanks again! I had closer look at the constructor as implemented (https://github.com/nextcloud/server/blob/master/lib/private/Streamer.php#L84) and I'm having a hard time understanding the train of thought there. It has been a while since I used PHP, but I read this as:
I see the point of using Zip32 as default whenever possible, as it is most likely the most widely supported among the three contenders here. What I don't understand is:
Shouldn't it be something like (do NOT use the code below as is unless you want to break your Nextcloud!): // Give me TAR no matter what if I say I want that
if ($request->isUserAgent($this->preferTarFor)) {
$this->streamerInstance = new TarStreamer();
// Zip32 as default if size and numberOfFiles allow it
} elseif ($size > 0 && $size < 4 * 1000 * 1000 * 1000 && $numberOfFiles < 65536) {
$this->streamerInstance = new ZipStreamer(['zip64' => false]);
// Depending on Zip64 support - not sure how one would determine that
} else {
if (isZip64Supported) {
$this->streamerInstance = new ZipStreamer(['zip64' => true]);
} else {
$this->streamerInstance = new TarStreamer();
}
} |
Hi, do you mind creating a PR with your patch for further discussion? |
@szaimen Assuming your comment was referring to my suggestion above: Done, see #27562. I'd like to add that I'm still successfully running the fix proposed by @Wolfgang1966. I am using only Linux machines, and my Nextcloud is for personal use only. So TAR is no issue for me, I assume that is not true for most Windows users. |
This issue is still relevant, I'm still getting this error when trying to download multiple GB of data and setting float instead of int in size seems to completely fix the problem |
Your answer is still valid with Nextcloud Hub II (23.0.3). |
When a folder larger than ~2GB is downloaded, zip32 doesn't cut it. Since zip64 doesn't work on 32-bit clients, fall back to generating a tarball. Fixes nextcloud#12422 and nextcloud#15117
When a folder larger than ~2GB is downloaded, zip32 doesn't cut it. Since zip64 doesn't work on 32-bit clients, fall back to generating a tarball. Fixes nextcloud#12422 and nextcloud#15117 Signed-off-by: fwsmit <[email protected]>
Closing due to nextcloud/documentation#9071 |
Steps to reproduce
I am wondering if it is possible to turn off the ZIP function when multiple files are downloaded, and whether that would resolve the issue.
Expected behaviour
Files should both be downloaded
Actual behaviour
Error is thrown.
Server configuration
Alpine 3.9 in Docker
Web server:
NGINX
Database:
MariaDB
PHP version:
7.2.13
Nextcloud version: (see Nextcloud admin page)
15.0.6
Updated from an older Nextcloud/ownCloud or fresh install:
Fresh install
Where did you install Nextcloud from:
https://hub.docker.com/r/linuxserver/nextcloud/
The text was updated successfully, but these errors were encountered: