mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Merge pull request #9108 from cakephp/issue-9106
Don't split strings headers that lack a ':'.
This commit is contained in:
commit
876b508797
2 changed files with 6 additions and 2 deletions
|
@ -577,7 +577,7 @@ class CakeResponse {
|
|||
if (is_numeric($header)) {
|
||||
list($header, $value) = array($value, null);
|
||||
}
|
||||
if ($value === null) {
|
||||
if ($value === null && strpos($header, ':') !== false) {
|
||||
list($header, $value) = explode(':', $header, 2);
|
||||
}
|
||||
$this->_headers[$header] = is_array($value) ? array_map('trim', $value) : trim($value);
|
||||
|
|
|
@ -164,11 +164,15 @@ class CakeResponseTest extends CakeTestCase {
|
|||
$headers += array('Location' => 'http://example.com');
|
||||
$this->assertEquals($headers, $response->header());
|
||||
|
||||
//Headers with the same name are overwritten
|
||||
// Headers with the same name are overwritten
|
||||
$response->header('Location', 'http://example2.com');
|
||||
$headers = array('Location' => 'http://example2.com');
|
||||
$this->assertEquals($headers, $response->header());
|
||||
|
||||
$response->header('Date', null);
|
||||
$headers += array('Date' => null);
|
||||
$this->assertEquals($headers, $response->header());
|
||||
|
||||
$response->header(array('WWW-Authenticate' => 'Negotiate'));
|
||||
$headers += array('WWW-Authenticate' => 'Negotiate');
|
||||
$this->assertEquals($headers, $response->header());
|
||||
|
|
Loading…
Reference in a new issue