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

From: Date: Thu, 12 Jun 2014 22:55:38 +0000
Subject: Bug #67428 [NEW]: header('Location: foo') will override a 308-399 response code
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-186163@lists.php.net to get a copy of this message
From: aharvey Operating system: Irrelevant PHP version: 5.4.29 Package: HTTP related Bug Type: Bug Bug description:header('Location: foo') will override a 308-399 response code 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 bug report at https://bugs.php.net/bug.php?id=67428&edit=1 --

« previous php.bugs (#186163) next »