From 4774946fbd6a6d5890b9c2dbc933865bdd532045 Mon Sep 17 00:00:00 2001 From: Filippo Tessarotto Date: Mon, 27 Apr 2020 08:55:12 +0200 Subject: [PATCH 1/2] [BrowserKit] Allow Referer set by history to be overridden (3.4) --- src/Symfony/Component/BrowserKit/Client.php | 2 +- src/Symfony/Component/BrowserKit/Tests/ClientTest.php | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/BrowserKit/Client.php b/src/Symfony/Component/BrowserKit/Client.php index 2e641e884ace..f2d43f66483f 100644 --- a/src/Symfony/Component/BrowserKit/Client.php +++ b/src/Symfony/Component/BrowserKit/Client.php @@ -294,7 +294,7 @@ public function request($method, $uri, array $parameters = [], array $files = [] $uri = preg_replace('{^'.parse_url($uri, PHP_URL_SCHEME).'}', $server['HTTPS'] ? 'https' : 'http', $uri); } - if (!$this->history->isEmpty()) { + if (!isset($server['HTTP_REFERER']) && !$this->history->isEmpty()) { $server['HTTP_REFERER'] = $this->history->current()->getUri(); } diff --git a/src/Symfony/Component/BrowserKit/Tests/ClientTest.php b/src/Symfony/Component/BrowserKit/Tests/ClientTest.php index a21a9481a7ac..de6e8f0d3ae7 100644 --- a/src/Symfony/Component/BrowserKit/Tests/ClientTest.php +++ b/src/Symfony/Component/BrowserKit/Tests/ClientTest.php @@ -233,6 +233,15 @@ public function testRequestReferer() $this->assertEquals('http://www.example.com/foo/foobar', $server['HTTP_REFERER'], '->request() sets the referer'); } + public function testRequestRefererCanBeOverridden() + { + $client = new TestClient(); + $client->request('GET', 'http://www.example.com/foo/foobar'); + $client->request('GET', 'bar', [], [], ['HTTP_REFERER' => 'xyz']); + $server = $client->getRequest()->getServer(); + $this->assertEquals('xyz', $server['HTTP_REFERER'], '->request() allows referer to be overridden'); + } + public function testRequestHistory() { $client = new TestClient(); From e69673562ccc42dd424d49a9865b0e2555fc85a4 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Sat, 16 May 2020 12:04:57 +0200 Subject: [PATCH 2/2] [VarDumper] fix for change in PHP 7.4.6 (bis) --- src/Symfony/Component/VarDumper/Caster/SplCaster.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Symfony/Component/VarDumper/Caster/SplCaster.php b/src/Symfony/Component/VarDumper/Caster/SplCaster.php index a30c2bce9e0d..b557b689d352 100644 --- a/src/Symfony/Component/VarDumper/Caster/SplCaster.php +++ b/src/Symfony/Component/VarDumper/Caster/SplCaster.php @@ -173,6 +173,7 @@ public static function castObjectStorage(\SplObjectStorage $c, array $a, Stub $s { $storage = []; unset($a[Caster::PREFIX_DYNAMIC."\0gcdata"]); // Don't hit https://bugs.php.net/65967 + unset($a["\0SplObjectStorage\0storage"]); $clone = clone $c; foreach ($clone as $obj) {