Edit report at https://bugs.php.net/bug.php?id=64187&edit=1
ID: 64187
Updated by: mike@php.net
Reported by: nachms+php at gmail dot com
Summary: CGI/FastCGI truncates input to modulo 4GB
-Status: Assigned
+Status: Feedback
Type: Bug
Package: Streams related
Operating System: Linux
PHP Version: 5.6
Assigned To: mike
Block user comment: N
Private report: N
New Comment:
Please try with a source build.
I've no problems POSTing or PUTting files of size 10G.
â mike@smugmug:~/tmp$ l -hl 10G
-rw-r--r-- 1 mike users 9.8G 1. Jul 21:44 10G
â mike@smugmug:~/tmp$ cat /srv/http/put.php
<?php
$tmp = tempnam("/var/tmp", "put");
var_dump(file_put_contents($tmp, fopen("php://input","r")), filesize($tmp),
unlink($tmp));
â mike@smugmug:~/build/php-5.6-dbg$ ./sapi/cgi/php-cgi -b 0:9999 -d post_max_size=99G -d
upload_max_filesize=99G
â mike@smugmug:~/tmp$ curl -v --upload-file ~/tmp/10G http://localhost:88/put.php
* Hostname was NOT found in DNS cache
* Trying ::1...
* connect to ::1 port 88 failed: Connection refused
* Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 88 (#0)
> PUT /put.php HTTP/1.1
> User-Agent: curl/7.37.0
> Host: localhost:88
> Accept: */*
> Content-Length: 10485760000
> Expect: 100-continue
>
< HTTP/1.1 100 Continue
* We are completely uploaded and fine
< HTTP/1.1 200 OK
* Server nginx/1.6.0 is not blacklisted
< Server: nginx/1.6.0
< Date: Wed, 16 Jul 2014 19:47:33 GMT
< Content-Type: text/html; charset=UTF-8
< Transfer-Encoding: chunked
< Connection: keep-alive
< X-Powered-By: PHP/5.6.0-dev
<
int(10485760000)
int(10485760000)
bool(true)
* Connection #0 to host localhost left intact
Previous Comments:
------------------------------------------------------------------------
[2014-07-15 22:06:37] nachms+php at gmail dot com
Yes, as I said in my previous post, it fails in php5-cgi_5.6.0~rc2+dfsg-3_amd64.deb, which as far as
I know is "5.6 or later".
Amount Read: 1374904320 (Should be Amount Read: 4296015872)
Was only able to send 1374978048 bytes. (Should not get this error)
------------------------------------------------------------------------
[2014-07-15 22:01:43] yohgaki@php.net
Starting from 5.6, PHP handles large 'php://input' and makes 'php://input'
reusable. This change will not be backported to older versions.
If this is fixed in 5.6, this bug should be closed.
Do you still have problem in 5.6 or later?
------------------------------------------------------------------------
[2014-07-13 11:09:16] nachms+php at gmail dot com
Okay, I found a binary at: http://ftp.us.debian.org/debian/pool/main/p/php5/php5-cgi_5.6.0~rc2+dfsg-3_amd64.deb
I'm now getting different results than 5.3, 5.4, and 5.5, but it still fails.
Amount Read: 1374904320 (Should be Amount Read: 4296015872)
Was only able to send 1374978048 bytes. (Should not get this error)
------------------------------------------------------------------------
[2014-07-13 11:02:10] nachms+php at gmail dot com
I don't have any version of 5.6 handy. It seems official downloads are supposed to be at http://qa.php.net/, but for some reason, that site isn't loading
for me. Is there an alternate location to download 5.6 from?
------------------------------------------------------------------------
[2014-07-13 09:53:26] yohgaki@php.net
Sorry for typo. Could you try 5.6?
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=64187
--
Edit this bug report at https://bugs.php.net/bug.php?id=64187&edit=1