[HttpFoundation] Update QUERY_STRING when overrideGlobals
This commit is contained in:
parent
71edf38d59
commit
777666fac1
@ -479,6 +479,8 @@ class Request
|
||||
*/
|
||||
public function overrideGlobals()
|
||||
{
|
||||
$this->server->set('QUERY_STRING', static::normalizeQueryString(http_build_query($this->query->all(), null, '&')));
|
||||
|
||||
$_GET = $this->query->all();
|
||||
$_POST = $this->request->all();
|
||||
$_SERVER = $this->server->all();
|
||||
|
@ -1009,6 +1009,15 @@ class RequestTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$this->assertArrayHasKey('HTTP_X_FORWARDED_PROTO', $_SERVER);
|
||||
|
||||
$request->initialize(array('foo' => 'bar', 'baz' => 'foo'));
|
||||
$request->query->remove('baz');
|
||||
|
||||
$request->overrideGlobals();
|
||||
|
||||
$this->assertEquals(array('foo' => 'bar'), $_GET);
|
||||
$this->assertEquals('foo=bar', $_SERVER['QUERY_STRING']);
|
||||
$this->assertEquals('foo=bar', $request->server->get('QUERY_STRING'));
|
||||
|
||||
// restore initial $_SERVER array
|
||||
$_SERVER = $server;
|
||||
}
|
||||
|
Reference in New Issue
Block a user