php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26990 PHP CGI does not handle Status header.
Submitted: 2004-01-21 06:58 UTC Modified: 2004-01-22 01:21 UTC
From: progcom@php.net Assigned:
Status: Not a bug Package: CGI/CLI related
PHP Version: 4.3.4 OS: FreeBSD 5.2
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: progcom@php.net
New email:
PHP Version: OS:

 

 [2004-01-21 06:58 UTC] progcom@php.net
Description:
------------
CGI version PHP does not handle 'Status: xxx' header.
By CGI 1.1 Spec, header('Status: xxx') can produce http response code.
(I can use 'HTTP/1.0 xxx', but I think CGI version should work with 'Status: xxx')

on http://hoohoo.ncsa.uiuc.edu/cgi/out.html ,

Status

This is used to give the server an HTTP/1.0 status line to send to the client. The format is nnn xxxxx, where nnn is the 3-digit status code, and xxxxx is the reason string, such as "Forbidden".

Reproduce code:
---------------
<?php
header('Status: 303 See Other');
header('Location: http://example.org');
?>

Expected result:
----------------
Status: 303
Content-type: text/html
Location: http://example.org


Actual result:
--------------
Status: 302
Content-type: text/html
Status: 303 See Other
Location: http://example.org

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-01-21 16:13 UTC] progcom@php.net
I tried lastest, but not fixed. (php4-STABLE-200401212030)
Same result as 4.3.4.

I found on main/SAPI.c, sapi_headers_op() controls header but there is no handles 'Status: xxx' header. Not fixed on CVS tree, also.
 [2004-01-21 19:24 UTC] sniper@php.net
This works:

<?php
header('Location: http://example.org', 0, 303);
?>

And next time, RTFM!

 [2004-01-21 22:54 UTC] progcom@php.net
Yes, It works, but PHP manual also said:

Note:  In PHP 3, this only works when PHP is compiled as an Apache module. You can achieve the same effect using the Status header.

<?php
header("Status: 404 Not Found");
?> 

It will be document problem? I don't know Apache's mod_cgi or other servers work with double 'Status' header, but I'm using PHP by FastCGI (mod_fcgi), It says:

FastCGI: comm with server "/path/to/php" aborted: error parsing headers: duplicate header 'Status'

I think PHP should follow CGI Spec., at least CGI version, isn't it?
 [2004-01-22 01:21 UTC] sniper@php.net
But this is PHP 4. (the note is for PHP3!)

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 09:01:27 2024 UTC