mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 11:06:15 +00:00
Fixed HTTP status codes for non-redirects which were breaking AuthComponent.
This commit is contained in:
parent
7695da637c
commit
2be9ac8888
2 changed files with 11 additions and 11 deletions
|
@ -770,18 +770,17 @@ class Controller extends Object implements CakeEventListener {
|
||||||
session_write_close();
|
session_write_close();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($status) && is_string($status)) {
|
|
||||||
$codes = array_flip($this->response->httpCodes());
|
|
||||||
if (isset($codes[$status])) {
|
|
||||||
$status = $codes[$status];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($url !== null) {
|
if ($url !== null) {
|
||||||
$this->response->header('Location', Router::url($url, true));
|
$this->response->header('Location', Router::url($url, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($status) && ($status >= 300 && $status < 400)) {
|
if (!empty($status)) {
|
||||||
|
if (is_string($status)) {
|
||||||
|
$codes = array_flip($this->response->httpCodes());
|
||||||
|
if (isset($codes[$status])) {
|
||||||
|
$status = $codes[$status];
|
||||||
|
}
|
||||||
|
}
|
||||||
$this->response->statusCode($status);
|
$this->response->statusCode($status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -728,7 +728,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"),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue