mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
Adding redirect fix for Ticket #1951
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4400 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
5a8cc752f1
commit
375276df4f
1 changed files with 18 additions and 5 deletions
|
@ -400,7 +400,7 @@ class Controller extends Object {
|
||||||
session_write_close();
|
session_write_close();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_numeric($status) && $status > 0) {
|
if (!empty($status)) {
|
||||||
$codes = array(
|
$codes = array(
|
||||||
100 => "Continue",
|
100 => "Continue",
|
||||||
101 => "Switching Protocols",
|
101 => "Switching Protocols",
|
||||||
|
@ -440,15 +440,28 @@ class Controller extends Object {
|
||||||
501 => "Not Implemented",
|
501 => "Not Implemented",
|
||||||
502 => "Bad Gateway",
|
502 => "Bad Gateway",
|
||||||
503 => "Service Unavailable",
|
503 => "Service Unavailable",
|
||||||
504 => "Gateway Time-out");
|
504 => "Gateway Time-out"
|
||||||
|
);
|
||||||
if (isset($codes[$status])) {
|
if (is_string($status)) {
|
||||||
header("HTTP/1.1 $status " . $codes[$status]);
|
$codes = array_combine(array_values($codes), array_keys($codes));
|
||||||
}
|
}
|
||||||
|
if (isset($codes[$status])) {
|
||||||
|
$code = ife(is_numeric($status), $status, $codes[$status]);
|
||||||
|
$msg = ife(is_string($status), $status, $codes[$status]);
|
||||||
|
$status = "HTTP/1.1 {$code} {$msg}";
|
||||||
|
} else {
|
||||||
|
$status = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!empty($status)) {
|
||||||
|
header($status);
|
||||||
}
|
}
|
||||||
if ($url !== null) {
|
if ($url !== null) {
|
||||||
header('Location: ' . Router::url($url, true));
|
header('Location: ' . Router::url($url, true));
|
||||||
}
|
}
|
||||||
|
if (!empty($status)) {
|
||||||
|
header($status);
|
||||||
|
}
|
||||||
if ($exit) {
|
if ($exit) {
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue