|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[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
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 16:00:02 2025 UTC |
header('HTTP/1.1 403 Forbidden', true, 403);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 lineCan 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.