#49592 [Opn->Csd]: Incorrect description of header() behavior

From: Date: Mon, 21 Sep 2009 09:09:31 +0000
Subject: #49592 [Opn->Csd]: Incorrect description of header() behavior
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-2797@lists.php.net to get a copy of this message
ID: 49592 Updated by: torben@php.net Reported By: travis at gymgenius dot com -Status: Open +Status: Closed Bug Type: Documentation problem PHP Version: 5.2.11 New Comment: This bug has been fixed in the documentation's XML sources. Since the online and downloadable versions of the documentation need some time to get updated, we would like to ask you to be a bit patient. Thank you for the report, and for helping us make our documentation better. PHP also looks for the 201 code when making this determination. This has now been mentioned in the docs. Previous Comments: ------------------------------------------------------------------------ [2009-09-21 09:08:27] svn@php.net Automatic comment from SVN on behalf of torben Revision: http://svn.php.net/viewvc/?view=revision&revision=288513 Log: Document that a previously-set 201 status code will also affect the magic handling of 'Location:'. Addresses bug #49592. ------------------------------------------------------------------------ [2009-09-18 16:19:20] travis at gymgenius dot com Description: ------------ The manual for header() states that: "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 some 3xx status code has already been set. " PHP not only preserves 3xx status codes, but also appears to preserve the 201 status code (which is desirable because the 201 code can also accompany the Location header field). Reproduce code: --------------- header('HTTP/1.1 201 Created', true, 201); header('Location: http://www.php.net'); Expected result: ---------------- HTTP/1.1 302 Found (if you go by the manual) Actual result: -------------- HTTP/1.1 201 Created ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=49592&edit=1

« previous php.doc.bugs (#2797) next »