Bug #76082 [Opn]: Http response status not working in 7.2 with header call

From: Date: Tue, 13 Mar 2018 09:35:51 +0000
Subject: Bug #76082 [Opn]: Http response status not working in 7.2 with header call
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-214326@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=76082&edit=1 ID: 76082 Updated by: ab@php.net Reported by: auroraeosrose@php.net Summary: Http response status not working in 7.2 with header call Status: Open Type: Bug Package: CGI/CLI related Operating System: Windows PHP Version: 7.2.3 Block user comment: N Private report: N New Comment: Same output here on CLI as Rasmus has shown. NGINX+FCGI through TCP socket as well as IIS through named pipe are same. Probably some further digging on the server config side is needed, seems something about server config right now. Thanks. Previous Comments: ------------------------------------------------------------------------ [2018-03-13 03:54:09] rasmus@php.net Can you reproduce from cli? eg. $ cat g <?php header('HTTP/1.1 403 Forbidden', true, 403); $ /usr/local/bin/php-cgi g Status: 403 Forbidden X-Powered-By: PHP/7.2.4-dev Content-type: text/html; charset=UTF-8 I don't see any changes in 7.2.3 that would cause this unless it is a weird Windows-only side-effect of an unrelated bug fix. ------------------------------------------------------------------------ [2018-03-12 17:47:43] auroraeosrose at gmail dot com I just did some additional testing This was introduced in 7.2.3 7.2.2 functions perfectly ------------------------------------------------------------------------ [2018-03-12 15:31:36] auroraeosrose at gmail dot com I tried that - it doesn't work either Entire script currently on system <?php // header('HTTP/1.1 403 Forbidden'); // doesn't work //header('HTTP/1.1 403 Forbidden', true, 403); // doesn't work http_response_code(403); // works, but not if you uncomment either earlier line ------------------------------------------------------------------------ [2018-03-12 15:24:00] spam2 at rhsoft dot net header('HTTP/1.1 403 Forbidden', true, 403); ------------------------------------------------------------------------ [2018-03-12 15:20:15] auroraeosrose@php.net Description: ------------ 64 bit Windows Server 2016 IIS10 Fastcgi PHP 7.1.1 <?php header('HTTP/1.1 403 Forbidden'); Works perfectly - 403 status provided IIS10 Fastcgi PHP 7.2.3 <?php header('HTTP/1.1 403 Forbidden'); Status returned is 200 OK <?php http_response_code(403); status returned is 403 Forbidden If you call the header and THEN call the http_response_code it still returns the 200 OK instead of the 403 So something is broken using headers to set response codes with fastcgi only in PHP 7.2 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=76082&edit=1

« previous php.bugs (#214326) next »