mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 17:16:18 +00:00
Make CakeRequest work with content-type headers that include a charset.
Refs #3113
This commit is contained in:
parent
65e63c51c8
commit
e183e91b17
2 changed files with 2 additions and 2 deletions
|
@ -165,7 +165,7 @@ class CakeRequest implements ArrayAccess {
|
||||||
$this->data = $_POST;
|
$this->data = $_POST;
|
||||||
} elseif ($this->is('put') || $this->is('delete')) {
|
} elseif ($this->is('put') || $this->is('delete')) {
|
||||||
$this->data = $this->_readInput();
|
$this->data = $this->_readInput();
|
||||||
if (env('CONTENT_TYPE') === 'application/x-www-form-urlencoded') {
|
if (strpos(env('CONTENT_TYPE'), 'application/x-www-form-urlencoded') === 0) {
|
||||||
parse_str($this->data, $this->data);
|
parse_str($this->data, $this->data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -233,7 +233,7 @@ class CakeRequestTest extends CakeTestCase {
|
||||||
*/
|
*/
|
||||||
public function testPutParsing() {
|
public function testPutParsing() {
|
||||||
$_SERVER['REQUEST_METHOD'] = 'PUT';
|
$_SERVER['REQUEST_METHOD'] = 'PUT';
|
||||||
$_SERVER['CONTENT_TYPE'] = 'application/x-www-form-urlencoded';
|
$_SERVER['CONTENT_TYPE'] = 'application/x-www-form-urlencoded; charset=UTF-8';
|
||||||
|
|
||||||
$data = array('data' => array(
|
$data = array('data' => array(
|
||||||
'Article' => array('title')
|
'Article' => array('title')
|
||||||
|
|
Loading…
Add table
Reference in a new issue