php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76082 Http response status not working in 7.2.3 NTS fastcgi with header call
Submitted: 2018-03-12 15:20 UTC Modified: 2018-04-11 18:46 UTC
From: auroraeosrose@php.net Assigned:
Status: Closed Package: CGI/CLI related
PHP Version: 7.2.3 OS: Windows
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: auroraeosrose@php.net
New email:
PHP Version: OS:

 

 [2018-03-12 15:20 UTC] 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


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-03-12 15:24 UTC] spam2 at rhsoft dot net
header('HTTP/1.1 403 Forbidden', true, 403);
 [2018-03-12 15:31 UTC] 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 17:47 UTC] 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-13 03:54 UTC] 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-13 09:35 UTC] ab@php.net
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.
 [2018-03-13 12:28 UTC] auroraeosrose at gmail dot com
It works correctly via cli and php-cgi via command line

It's ONLY erroring using fastcgi with IIS 10 64 bit with an NTS build!

I just tried a TS build of 7.2.3 and THAT works

I'm using the exact same configuration with only one change (swapping php-cgi.exe to a different sub-folder where PHP is stored) no other changes to the server or configuration

This is the weirdest thing in the world.
 [2018-03-13 12:36 UTC] auroraeosrose@php.net
-Summary: Http response status not working in 7.2 with header call +Summary: Http response status not working in 7.2.3 NTS fastcgi with header call
 [2018-03-13 12:36 UTC] auroraeosrose@php.net
Verified this is some kind of threading/build problem
added that is only affects 7.2.3 NTS in fastcgi mode
thread safe compile of 7.2.3 is working
 [2018-03-14 11:50 UTC] ab@php.net
Hmm, then I stuck probably, as the checks I did before was exactly with NTS. However it was the current dev, perhaps that makes the diff :/

Thanks.
 [2018-03-15 16:55 UTC] auroraeosrose@php.net
Yeah, if you were testing with the current dev build and not the binary in downloads for 7.2.3 64 bit nts from windows.php.net you might not hit the issue.

If I have time later this week I'll test with a snapshot build and see if it's fixed.  However shipping a broken binary isn't great either.
 [2018-04-11 18:46 UTC] auroraeosrose@php.net
-Status: Open +Status: Closed
 [2018-04-11 18:46 UTC] auroraeosrose@php.net
This is no longer an issue in 7.4
Definitely a bad 7.3-nts release
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu Jan 21 16:01:23 2021 UTC