Add workaround when IE11 submit corrupted multipart/form-data
This commit is contained in:
@@ -105,7 +105,7 @@ class Request extends Base
|
|||||||
{
|
{
|
||||||
if (! empty($this->post) && ! empty($this->post['csrf_token']) && $this->token->validateCSRFToken($this->post['csrf_token'])) {
|
if (! empty($this->post) && ! empty($this->post['csrf_token']) && $this->token->validateCSRFToken($this->post['csrf_token'])) {
|
||||||
unset($this->post['csrf_token']);
|
unset($this->post['csrf_token']);
|
||||||
return $this->post;
|
return $this->filterValues($this->post);
|
||||||
}
|
}
|
||||||
|
|
||||||
return array();
|
return array();
|
||||||
@@ -344,4 +344,17 @@ class Request extends Base
|
|||||||
{
|
{
|
||||||
return isset($this->server[$variable]) ? $this->server[$variable] : '';
|
return isset($this->server[$variable]) ? $this->server[$variable] : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function filterValues(array $values)
|
||||||
|
{
|
||||||
|
foreach ($values as $key => $value) {
|
||||||
|
|
||||||
|
// IE11 Workaround when submitting multipart/form-data
|
||||||
|
if (strpos($key, '-----------------------------') === 0) {
|
||||||
|
unset($values[$key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $values;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,6 +43,9 @@ class RequestTest extends Base
|
|||||||
|
|
||||||
$request = new Request($this->container, array(), array(), array('myvar' => 'myvalue', 'csrf_token' => $this->container['token']->getCSRFToken()), array(), array());
|
$request = new Request($this->container, array(), array(), array('myvar' => 'myvalue', 'csrf_token' => $this->container['token']->getCSRFToken()), array(), array());
|
||||||
$this->assertEquals(array('myvar' => 'myvalue'), $request->getValues());
|
$this->assertEquals(array('myvar' => 'myvalue'), $request->getValues());
|
||||||
|
|
||||||
|
$request = new Request($this->container, array(), array(), array('myvar' => 'myvalue', '-----------------------------7e1c32510025c--' => '', 'csrf_token' => $this->container['token']->getCSRFToken()), array(), array());
|
||||||
|
$this->assertEquals(array('myvar' => 'myvalue'), $request->getValues());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetFileContent()
|
public function testGetFileContent()
|
||||||
|
|||||||
Reference in New Issue
Block a user