Merge pull request #633 from Phally/2.1

Redirect check is breaking AuthComponent redirect status codes
This commit is contained in:
Mark Story 2012-05-05 08:15:00 -07:00
commit 17a00eb2e9
2 changed files with 10 additions and 9 deletions

View file

@ -531,7 +531,7 @@ class Controller extends Object implements CakeEventListener {
} }
/** /**
* Merge components, helpers, and uses vars from * Merge components, helpers, and uses vars from
* Controller::$_mergeParent and PluginAppController. * Controller::$_mergeParent and PluginAppController.
* *
* @return void * @return void
@ -770,18 +770,18 @@ class Controller extends Object implements CakeEventListener {
session_write_close(); session_write_close();
} }
if (!empty($status) && is_string($status)) { if ($url !== null) {
$this->response->header('Location', Router::url($url, true));
}
if (is_string($status)) {
$codes = array_flip($this->response->httpCodes()); $codes = array_flip($this->response->httpCodes());
if (isset($codes[$status])) { if (isset($codes[$status])) {
$status = $codes[$status]; $status = $codes[$status];
} }
} }
if ($url !== null) { if ($status) {
$this->response->header('Location', Router::url($url, true));
}
if (!empty($status) && ($status >= 300 && $status < 400)) {
$this->response->statusCode($status); $this->response->statusCode($status);
} }

View file

@ -387,7 +387,7 @@ class AnotherTestController extends ControllerTestAppController {
/** /**
* merge parent * merge parent
* *
* @var string * @var string
*/ */
protected $_mergeParent = 'ControllerTestAppController'; protected $_mergeParent = 'ControllerTestAppController';
@ -729,7 +729,8 @@ class ControllerTest extends CakeTestCase {
array(303, "See Other"), array(303, "See Other"),
array(304, "Not Modified"), array(304, "Not Modified"),
array(305, "Use Proxy"), array(305, "Use Proxy"),
array(307, "Temporary Redirect") array(307, "Temporary Redirect"),
array(403, "Forbidden"),
); );
} }