Bug #61417 [NEW]: header() does not necessarily send a raw HTTP header
| From: | chealer at gmail dot com | Date: | Fri, 16 Mar 2012 16:55:54 +0000 |
| Subject: | Bug #61417 [NEW]: header() does not necessarily send a raw HTTP header | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-8071@lists.php.net to get a copy of this message | ||
From:
Operating system:
PHP version: Irrelevant
Package: Documentation problem
Bug Type: Bug
Bug description:header() does not necessarily send a raw HTTP header
Description:
------------
http://ca2.php.net/manual/en/function.header.php
contains:
header â Send a raw HTTP header
header() is used to send a raw HTTP header. See the » HTTP/1.1
specification for more information on HTTP headers.
However, sending raw HTTP headers is only one of header()'s functions.
Other important functions include sending a Status-Line and setting CGI
fields.
In fact, the documentation page itself shows such examples:
There are two special-case header calls. The first is a header that starts
with the string "HTTP/" (case is not significant), which will be used to
figure out the HTTP status code to send. For example, if you have
configured Apache to use a PHP script to handle requests for missing files
(using the ErrorDocument directive), you may want to make sure that your
script generates the proper status code.
<?php
header("HTTP/1.0 404 Not Found");
?>
For FastCGI you must use the following for a 404 response:
<?php
header("Status: 404 Not Found");
?>
The second special case is the "Location:" header. Not only does it send
this header back to the browser, but it also returns a REDIRECT (302)
status code to the browser unless the 201 or a 3xx status code has already
been set.
<?php
header("Location: http://www.example.com/");
/* Redirect browser */
/* Make sure that code below does not get executed when we redirect. */
exit;
?>
CGI fields are documented in
http://tools.ietf.org/html/rfc3875#section-6.3
Status is *not* an HTTP header - running
header("Status: 404 Not Found");
when not in CGI mode will send a raw "Status" HTTP header, which is
undefined.
--
Edit bug report at https://bugs.php.net/bug.php?id=61417&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=61417&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=61417&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=61417&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=61417&r=fixed
Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=61417&r=needdocs
Fixed in release: https://bugs.php.net/fix.php?id=61417&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=61417&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=61417&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=61417&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=61417&r=support
Expected behavior: https://bugs.php.net/fix.php?id=61417&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=61417&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=61417&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=61417&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=61417&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=61417&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=61417&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=61417&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=61417&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=61417&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=61417&r=mysqlcfg