Bug #67428 [Asn->Csd]: header('Location: foo') will override a 308-399 response code

From: Date: Fri, 13 Jun 2014 00:43:08 +0000
Subject: Bug #67428 [Asn->Csd]: header('Location: foo') will override a 308-399 response code
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-186166@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=67428&edit=1 ID: 67428 Updated by: aharvey@php.net Reported by: aharvey@php.net Summary: header('Location: foo') will override a 308-399 response code -Status: Assigned +Status: Closed Type: Bug Package: HTTP related Operating System: Irrelevant PHP Version: 5.4.29 Assigned To: aharvey Block user comment: N Private report: N New Comment: The fix for this bug has been committed. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. For Windows: http://windows.php.net/snapshots/ Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2014-06-12 22:55:37] aharvey@php.net Description: ------------ header('Location: foo') overrides the response code if it isn't 201 or 301-307, inclusive. With 308 Permanent Redirect now being added to HTTP 1.1, this is overly restrictive. We should prevent changing the response code for any 3xx response code. Test script: --------------- <?php header('HTTP/1.1 308 Permanent Redirect'); header('Location: http://foo.bar'); ?> Expected result: ---------------- HTTP/1.1 308 Permanent Redirect Host: localhost:8000 Connection: close X-Powered-By: PHP/5.5.13-dev Location: http://foo.bar Content-type: text/html Actual result: -------------- HTTP/1.1 302 Found Host: localhost:8000 Connection: close X-Powered-By: PHP/5.5.13-dev Location: http://foo.bar Content-type: text/html ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=67428&edit=1

« previous php.bugs (#186166) next »