mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Fixing Accept header parsing so content types with leading/trailing spaces
are treated as spaceless. Fixes #1684
This commit is contained in:
parent
ec79a09d27
commit
72ef310867
2 changed files with 5 additions and 1 deletions
|
@ -176,6 +176,7 @@ class RequestHandlerComponent extends Object {
|
|||
*/
|
||||
function __construct() {
|
||||
$this->__acceptTypes = explode(',', env('HTTP_ACCEPT'));
|
||||
$this->__acceptTypes = array_map('trim', $this->__acceptTypes);
|
||||
|
||||
foreach ($this->__acceptTypes as $i => $type) {
|
||||
if (strpos($type, ';')) {
|
||||
|
|
|
@ -469,7 +469,10 @@ class RequestHandlerComponentTest extends CakeTestCase {
|
|||
$this->_init();
|
||||
$this->assertTrue($this->RequestHandler->isWap());
|
||||
|
||||
$_SERVER['HTTP_ACCEPT'] = 'application/rss+xml,text/xml,application/xml,application/xhtml+xml,text/html,text/plain,image/png,*/*';
|
||||
$_SERVER['HTTP_ACCEPT'] = 'application/rss+xml , text/xml, application/xml,application/xhtml+xml';
|
||||
$this->_init();
|
||||
$this->assertFalse($this->RequestHandler->isAtom());
|
||||
$this->assertTrue($this->RequestHandler->isRSS());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue