Bug #75870 [Opn->Fbk]: header() terminates execution when Content-Length is 0
| From: | requinix@php.net | Date: | Wed, 24 Jan 2018 23:12:03 +0000 |
| Subject: | Bug #75870 [Opn->Fbk]: header() terminates execution when Content-Length is 0 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-213698@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: requinix@php.net
Reported by: km dot wrona at gmail dot com
Summary: header() terminates execution when Content-Length is
0
-Status: Open
+Status: Feedback
Type: Bug
-Package: *General Issues
+Package: FPM related
Operating System: Alpine
PHP Version: 7.1.13
Block user comment: N
Private report: N
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[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
------------------------------------------------------------------------
[2018-01-24 21:30:46] km dot wrona at gmail dot com
nginx 1.12.2
php-fpm 7.1.12
I've changed the test script in accordance with your advice to the following:
----
header('content-length: 0', false, null);
touch('/var/www/html/'.time());
die('done');
----
Neither the file was created nor the "done" was displayed.
I've rebuilt my container to use php7.2.1 and it's exactly the same.
------------------------------------------------------------------------
[2018-01-24 20:23:32] requinix@php.net
What web server (Apache, nginx, etc.) and how is PHP running (like via module or FPM)?
And are you sure *execution* stops or can you simply not see the output? Try something like
touch()ing a file.
------------------------------------------------------------------------
[2018-01-24 18:03:30] km dot wrona at gmail dot com
Description:
------------
header() terminates execution when content-length is 0
This happens on Alpine3.7 php 7.1.12, for some reason not available in the list above.
It works fine on Ubuntu 16.04 php 7.1.13
Test script:
---------------
<?php
header('content-length: 0', false, null);
echo 'this is longer than 0';
exit;
Expected result:
----------------
this is longer than 0
Actual result:
--------------
NOTHING (BLANK)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=75870&edit=1