Bug #75870 [Fbk->Opn]: header() terminates execution when Content-Length is 0

From: Date: Thu, 25 Jan 2018 08:15:33 +0000
Subject: Bug #75870 [Fbk->Opn]: header() terminates execution when Content-Length is 0
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-213701@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 User updated by: km dot wrona at gmail dot com Reported by: km dot wrona at gmail dot com Summary: header() terminates execution when Content-Length is 0 -Status: Feedback +Status: Open Type: Bug Package: FPM related Operating System: Alpine PHP Version: 7.1.13 Block user comment: N Private report: N New Comment: No gzip enabled. Previous Comments: ------------------------------------------------------------------------ [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 ------------------------------------------------------------------------ [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. ------------------------------------------------------------------------ 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

« previous php.bugs (#213701) next »