Bug #75870 [Opn->Asn]: header() terminates execution when Content-Length is 0
| From: | bukka@php.net | Date: | Tue, 30 Nov 2021 22:09:24 +0000 |
| Subject: | Bug #75870 [Opn->Asn]: header() terminates execution when Content-Length is 0 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-238067@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=75870&edit=1
ID: 75870
Updated by: bukka@php.net
Reported by: km dot wrona at gmail dot com
Summary: header() terminates execution when Content-Length is
0
-Status: Open
+Status: Assigned
Type: Bug
Package: FPM related
Operating System: Alpine
PHP Version: 7.1.13
-Assigned To:
+Assigned To: bukka
Block user comment: N
Private report: N
New Comment:
Sorry for the delay in checking this out but I don't think there's anything wrong with
this. At least I don't understand why you expect body to show if you set content-length to 0? I
don't think FPM should modify it as it was explicitly set by the user so it will send it to the
web server (nginx in your case) and body is then ignored.
Previous Comments:
------------------------------------------------------------------------
[2018-01-25 08:15:32] km dot wrona at gmail dot com
No gzip enabled.
------------------------------------------------------------------------
[2018-01-25 00:52:04] requinix@php.net
Can you check that gzip thing with nginx? Though I haven't seen anything to explicitly state it
cuts off content, I know it will respect a Content-Length to some degree.
------------------------------------------------------------------------
[2018-01-25 00:49:34] km dot wrona at gmail dot com
Modified the script again to be:
----
touch('/tmp/1');
header('content-length:0',false, null);
touch('/tmp/2');
die('done');
----
Both 1 and 2 exist, no "done" is displayed, so it looks like it does not terminate...
------------------------------------------------------------------------
[2018-01-24 23:12:02] requinix@php.net
Were permissions on /var/www/html set to allow the new file? Try in /tmp instead.
And do you have the gzip module installed and enabled in nginx? Try without.
------------------------------------------------------------------------
[2018-01-24 22:49:38] spam2 at rhsoft dot net
cause and effect
pretty sure beause of the empty content-length the connection to the fcgi-worker is closed and so as
result the script terminated - either use output-buffering or user_abort_ignore(true) and that would
be impossible to happen beause with output buffering anything starts to hits the cient *after* the
whole script has finished and most applications use ob_stzart() anyways to have the capability send
headers at any point in time
http://php.net/manual/de/function.ignore-user-abort.php
http://php.net/manual/de/function.ob-start.php
------------------------------------------------------------------------
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=75870
--
Edit this bug report at https://bugs.php.net/bug.php?id=75870&edit=1