Bug #74395 [Com]: Support 4g files in stream_copy_to_stream() on 32 bit php builds
| From: | spam2 at rhsoft dot net | Date: | Sun, 09 Apr 2017 09:52:57 +0000 |
| Subject: | Bug #74395 [Com]: Support 4g files in stream_copy_to_stream() on 32 bit php builds | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-208404@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=74395&edit=1
ID: 74395
Comment by: spam2 at rhsoft dot net
Reported by: maggus dot staab at googlemail dot com
Summary: Support 4g files in stream_copy_to_stream() on 32
bit php builds
Status: Open
Type: Bug
Package: Streams related
PHP Version: 7.1.3
Block user comment: N
Private report: N
New Comment:
the better question is why is PHP on 32bit limited that way?
couldn't it use longint as other applications do?
Previous Comments:
------------------------------------------------------------------------
[2017-04-09 09:47:48] maggus dot staab at googlemail dot com
As userland workaround exists for this exists I guess a builtin handling of such files would/should
also work?
-------
Quote:
Got it working with following patch:
/www/nextcloud/3rdparty/sabre/http/lib/Sapi.php@78:
while (!feof($body)) {
// stream_copy_to_stream($body, $output, $contentLength);
fwrite($output,fread($body,8192));
}
Instead of copying entire file at once, it copies chunks of 8MB
Bit crude, but the concept works :)
Based on: http://php.net/manual/en/function.stream-copy-to-stream.php#98119
----------
See https://github.com/nextcloud/server/issues/1707#issuecomment-288890497
------------------------------------------------------------------------
[2017-04-09 09:34:39] maggus dot staab at googlemail dot com
Description:
------------
stream_copy_to_stream() expects the 3rd arg to be a integer which limits its max value on 32 bit
builds. This means some real world use cases dont work because the MAX_INT is not big enough to
handle 4GB+ filesizes.
Could we handle the arg like a string to support "huge files" on 32 bit php?
https://github.com/nextcloud/server/issues/1707#issuecomment-288890497
Expected result:
----------------
Copy of streams with filesize >= 4gb should be supported
Actual result:
--------------
stream_copy_to_stream() expects parameter 3 to be integer, string
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=74395&edit=1