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.
Files should both be downloaded
Error is thrown.
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/
Same behaviour on my system. Try download a directory greater then (approx) 1GB will result in an error.
System
server version 16.0.5.1
php version 7.3.6
database type mysql
app files version 1.11.0
app files_rightclick version 0.15.1
Log
[index] Error: TypeError: Argument 2 passed to OC\Streamer::__construct() must be of the type int, float given, called in /rootdir/www/cloud.webspace.de/lib/private/legacy/files.php on line 166 at <
>
- /rootdir/www/cloud.webspace.de/lib/private/legacy/files.php line 166
OC\Streamer->__construct(OC\AppFramework\Http\Request {}, 2636124555, 2677)- /rootdir/www/cloud.webspace.de/apps/files/ajax/download.php line 64
OC_Files::get("/DirOne", "DirTwo", {head: false})- /rootdir/www/cloud.webspace.de/lib/private/Route/Route.php line 155
undefinedundefinedrequire_once("/rootdir ... p")- <
>
OC\Route\Route->OC\Route{closure}("* sensitive parameters replaced *")- /rootdir/www/cloud.webspace.de/lib/private/Route/Router.php line 297
undefinedundefinedcall_user_func(Closure {}, {_route: "files_ajax_download"})- /rootdir/www/cloud.webspace.de/lib/base.php line 975
OC\Route\Router->match("/apps/files/ajax/download.php")- /rootdir/www/cloud.webspace.de/index.php line 42
OC::handleRequest()GET /index.php/apps/files/ajax/download.php?dir=%2FPr%C3%A4sident&files=Alt-1.%20Vorsitzender&downloadStartSecret=tfh2iarlrgm
from 79.245.161.234 by user at 2019-10-09T19:07:05+00:00
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
docker version of NextCloud
server version 16.0.5.1
php version 7.3.9
database type mysql 10.3.17
Log
[index] Error: TypeError: Argument 2 passed to OC\Streamer::__construct() must be of the type int, float given, called in /data/nextcloud/lib/private/legacy/files.php on line 166 at <
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
from 132.252.197.182 by user at 2019-10-23T10:50:41+00:00
Exact same thing happens to me too.
Nextcloud 16.0.5 SNAP
Apache 2.4
PHP 7.2
MySQL 5.7
Redis 4.0
Same issue observed.
Nextcloud 18.0.1
PHP:
Version: 7.4.3
Memory Limit: 512 MB
Max Execution Time: 3600
Upload max size: 2 MB
Database :
Type: pgsql
Version: PostgreSQL 12.1 on armv7l-unknown-linux-gnueabihf, compiled by armv7l-unknown-linux-gnueabihf-gcc (GCC) 8.3.0, 32-bit
Size: 33 MB
{"reqId":"mFHQwBnn4doFZXwCb9bC","level":3,"time":"2020-03-01T10:36:46+00:00","remoteAddr":"192.168.1.100","user":"dim","app":"index","method":"GET","url":"/index.php/apps/files/ajax/download.php?dir=%2FInstantUpload%2FCamera&files=%5B%2220200131_125453.jpg%22%2C%2220200131_105724.mp4%22%2C%2220200131_110441.jpg%22%2C%2220200131_104941.mp4%22%2C%2220200130_122239.mp4%22%2C%2220200131_105842.mp4%22%2C%2220200131_104313.mp4%22%2C%2220200130_121830.mp4%22%2C%2220200128_150025.mp4%22%2C%2220200130_121323.mp4%22%2C%2220200131_125816.jpg%22%2C%2220200131_112309.jpg%22%2C%2220200131_112313.jpg%22%2C%2220200130_121401.mp4%22%2C%2220200129_132052.jpg%22%2C%2220200131_105141.mp4%22%2C%2220200131_112257.jpg%22%2C%2220200131_105600.mp4%22%2C%2220200130_122311.mp4%22%2C%2220200131_104439.mp4%22%2C%2220200131_110519.jpg%22%2C%2220200131_110515.jpg%22%5D&downloadStartSecret=t1h1q2z32z","message":{"Exception":"TypeError","Message":"Argument 2 passed to OC\\Streamer::__construct() must be of the type int, float given, called in /usr/share/webapps/nextcloud/lib/private/legacy/files.php on line 167","Code":0,"Trace":[{"file":"/usr/share/webapps/nextcloud/lib/private/legacy/files.php","line":167,"function":"__construct","class":"OC\\Streamer","type":"->"},{"file":"/usr/share/webapps/nextcloud/apps/files/ajax/download.php","line":64,"function":"get","class":"OC_Files","type":"::"},{"file":"/usr/share/webapps/nextcloud/lib/private/Route/Route.php","line":155,"args":["/usr/share/webapps/nextcloud/apps/files/ajax/download.php"],"function":"require_once"},{"function":"OC\\Route\\{closure}","class":"OC\\Route\\Route","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/usr/share/webapps/nextcloud/lib/private/Route/Router.php","line":299,"function":"call_user_func"},{"file":"/usr/share/webapps/nextcloud/lib/base.php","line":1008,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/usr/share/webapps/nextcloud/index.php","line":38,"function":"handleRequest","class":"OC","type":"::"}],"File":"/usr/share/webapps/nextcloud/lib/private/Streamer.php","Line":55,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (X11; Linux x86_64; rv:73.0) Gecko/20100101 Firefox/73.0","version":"18.0.1.3","id":"5e5b9053a9d72"}
I have a similar error when sharing a folder that contains eight 2 GB files and one 882 MB files. Nextcloud: 16.0.5
(paths and adresses censored for privacy reasons)
[index] Error: TypeError: Argument 2 passed to OC\Streamer::__construct() must be of the type integer, float given, called in βββββββββββββ/lib/private/legacy/files.php on line 166 at <<closure>>
0. βββββββββββββ/lib/private/legacy/files.php line 166
OC\Streamer->__construct(OC\AppFramework\Http\Request {}, 17680871125, 10)
1. βββββββββββββ/apps/files_sharing/lib/Controller/ShareController.php line 605
OC_Files::get("/HR3", "AE", {head: false})
2. βββββββββββββ/lib/private/AppFramework/Http/Dispatcher.php line 166
OCA\Files_Sharing\Controller\ShareController->downloadShare("wCqm29mARgn4TTz", null, "", "")
3. βββββββββββββ/lib/private/AppFramework/Http/Dispatcher.php line 99
OC\AppFramework\Http\Dispatcher->executeController(OCA\Files_Sharin ... {}, "downloadShare")
4. βββββββββββββ/lib/private/AppFramework/App.php line 126
OC\AppFramework\Http\Dispatcher->dispatch(OCA\Files_Sharin ... {}, "downloadShare")
5. βββββββββββββ/lib/private/AppFramework/Routing/RouteActionHandler.php line 47
OC\AppFramework\App::main("OCA\\Files_Shar ... r", "downloadShare", OC\AppFramework\ ... {}, {token: "wCqm29m ... "})
6. <<closure>>
OC\AppFramework\Routing\RouteActionHandler->__invoke({token: "wCqm29m ... "})
7. βββββββββββββ/lib/private/Route/Router.php line 297
undefinedundefinedcall_user_func(OC\AppFramework\ ... {}, {token: "wCqm29m ... "})
8. βββββββββββββ/lib/base.php line 975
OC\Route\Router->match("/s/wCqm29mARgn4TTz/download")
9. βββββββββββββ/index.php line 42
OC::handleRequest()
GET /index.php/s/wCqm29mARgn4TTz/download
from ββββ:ββ:βββ:ββββ:ββββ:ββββ:ββββ:ββββ at 2020-03-07T11:24:41+00:00
Same occured:
{"reqId":"HrbLX7O275Q5yJmqjccC","level":3,"time":"April 06, 2020 15:44:31","remoteAddr":"XXXXXXXXXX","user":"--","app":"index","method":"GET","url":"/index.php/s/XXXXX/download","message":{"Exception":"Exception","Message":"Argument 2 passed to OC\\Streamer::__construct() must be of the type int, float given, called in /var/www/nextcloud/lib/private/legacy/files.php on line 167","Code":0,"Trace":[{"file":"/var/www/nextcloud/lib/private/AppFramework/App.php","line":125,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Files_Sharing\\Controller\\ShareController"},"downloadShare"]},{"file":"/var/www/nextcloud/lib/private/AppFramework/Routing/RouteActionHandler.php","line":47,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Files_Sharing\\Controller\\ShareController","downloadShare",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},{"token":"XXXXXXX","_route":"files_sharing.sharecontroller.downloadShare"}]},{"function":"__invoke","class":"OC\\AppFramework\\Routing\\RouteActionHandler","type":"->","args":[{"token":"XXXXXXXXXX","_route":"files_sharing.sharecontroller.downloadShare"}]},{"file":"/var/www/nextcloud/lib/private/Route/Router.php","line":299,"function":"call_user_func","args":[{"__class__":"OC\\AppFramework\\Routing\\RouteActionHandler"},{"token":"XXXXXXX","_route":"files_sharing.sharecontroller.downloadShare"}]},{"file":"/var/www/nextcloud/lib/base.php","line":1008,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/s/XXXXXXXXXX/download"]},{"file":"/var/www/nextcloud/index.php","line":38,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","Line":109,"Previous":{"Exception":"TypeError","Message":"Argument 2 passed to OC\\Streamer::__construct() must be of the type int, float given, called in /var/www/nextcloud/lib/private/legacy/files.php on line 167","Code":0,"Trace":[{"file":"/var/www/nextcloud/lib/private/legacy/files.php","line":167,"function":"__construct","class":"OC\\Streamer","type":"->","args":[{"__class__":"OC\\AppFramework\\Http\\Request"},15653449121,14074]},{"file":"/var/www/nextcloud/apps/files_sharing/lib/Controller/ShareController.php","line":626,"function":"get","class":"OC_Files","type":"::","args":["/PENS/Ventin","PEN 1",{"head":false}]},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":170,"function":"downloadShare","class":"OCA\\Files_Sharing\\Controller\\ShareController","type":"->","args":["XXXXXXXX",null,"",""]},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":99,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Files_Sharing\\Controller\\ShareController"},"downloadShare"]},{"file":"/var/www/nextcloud/lib/private/AppFramework/App.php","line":125,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Files_Sharing\\Controller\\ShareController"},"downloadShare"]},{"file":"/var/www/nextcloud/lib/private/AppFramework/Routing/RouteActionHandler.php","line":47,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Files_Sharing\\Controller\\ShareController","downloadShare",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},{"token":"XXXXXXXX","_route":"files_sharing.sharecontroller.downloadShare"}]},{"function":"__invoke","class":"OC\\AppFramework\\Routing\\RouteActionHandler","type":"->","args":[{"token":"XXXXXXXXXXXXX","_route":"files_sharing.sharecontroller.downloadShare"}]},{"file":"/var/www/nextcloud/lib/private/Route/Router.php","line":299,"function":"call_user_func","args":[{"__class__":"OC\\AppFramework\\Routing\\RouteActionHandler"},{"token":"XXXXXXXXXXX","_route":"files_sharing.sharecontroller.downloadShare"}]},{"file":"/var/www/nextcloud/lib/base.php","line":1008,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/s/XXXXXXXXXX/download"]},{"file":"/var/www/nextcloud/index.php","line":38,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/nextcloud/lib/private/Streamer.php","Line":55},"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36","version":"18.0.1.3"}
System
server version 18.0.1.3
php version 7.3.11
database type mysql Ver 15.1 Distrib 10.3.18-MariaDB
I have the same issue. Is there any workaround or patch for this yet ?
System
server version 18.0.3
php version 7.3.13
database sqlite3
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.
Argument 2 passed to OC\Streamer::__construct() must be of the type int, float given, called in /data/nextcloud/lib/private/legacy/files.php on line 167
The user experience for anyone receiving the file:

Same issue:
Exception: Argument 2 passed to OC\Streamer::__construct() must be of the type int, float given, called in /var/www/nextcloud/lib/private/legacy/files.php on line 167
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, int $size, int $numberOfFiles)
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:
if ($size > 0 && $size < 4 * 1000 * 1000 * 1000 && $numberOfFiles < 65536) {
$this->streamerInstance = new ZipStreamer(['zip64' => false]);
} else {
$this->streamerInstance = new TarStreamer();
}
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.
Most helpful comment
The fix seems to be a one-liner basically:
In lib/private/Streamer.php
exchange
public function __construct(IRequest $request, int $size, int $numberOfFiles)
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