|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2017-02-14 14:21 UTC] viskoo at gmail dot com
[2018-06-14 11:12 UTC] mike@php.net
-Status: Open
+Status: Feedback
[2018-06-14 11:12 UTC] mike@php.net
[2018-06-24 04:25 UTC] php-bugs at lists dot php dot net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 14:00:01 2025 UTC |
Description: ------------ If you open stdin, to read the body of a PUT request, echo some strings, and then use flush() to flush the output buffer, PHP will hang after reading 192 kbytes from the input stream, on the next flush() call. This only happens if it's the stdin stream that is open, and not with any other (eg. random local file) stream, and it always happens after reading 48 * 4096 bytes. You will need a web server (I tested with nginx) configured, to test this. Test script: --------------- <?php $file = 'php://input'; $stream = fopen($file, 'r'); fopen($file, 'rb'); header('X-Accel-Buffering: no'); // tell nginx not to buffer $count = 0; while ($chunk = fread($stream, 4096)) { $count++; echo "Read some chunks: $count\n"; flush(); // this is the call that hangs, if you remove this, the script runs fine } echo("Script finished"); Expected result: ---------------- Read some chunks: 1 Read some chunks: 2 Read some chunks: 3 Read some chunks: 4 .... Script finished Actual result: -------------- Read some chunks: 1 Read some chunks: 2 Read some chunks: 3 Read some chunks: 4 .... Read some chunks: 48 *hangs until timeout*