Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 94e8c42

Browse files
Merge branch '3.4' into 4.4
* 3.4: [VarDumper] fix for change in PHP 7.4.6 (bis) [BrowserKit] Allow Referer set by history to be overridden (3.4)
2 parents 1e9486d + cb7e78c commit 94e8c42

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

src/Symfony/Component/BrowserKit/Client.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ public function request(string $method, string $uri, array $parameters = [], arr
380380
$uri = preg_replace('{^'.parse_url($uri, PHP_URL_SCHEME).'}', $server['HTTPS'] ? 'https' : 'http', $uri);
381381
}
382382

383-
if (!$this->history->isEmpty()) {
383+
if (!isset($server['HTTP_REFERER']) && !$this->history->isEmpty()) {
384384
$server['HTTP_REFERER'] = $this->history->current()->getUri();
385385
}
386386

src/Symfony/Component/BrowserKit/Tests/AbstractBrowserTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,15 @@ public function testRequestReferer()
230230
$this->assertEquals('http://www.example.com/foo/foobar', $server['HTTP_REFERER'], '->request() sets the referer');
231231
}
232232

233+
public function testRequestRefererCanBeOverridden()
234+
{
235+
$client = new TestClient();
236+
$client->request('GET', 'http://www.example.com/foo/foobar');
237+
$client->request('GET', 'bar', [], [], ['HTTP_REFERER' => 'xyz']);
238+
$server = $client->getRequest()->getServer();
239+
$this->assertEquals('xyz', $server['HTTP_REFERER'], '->request() allows referer to be overridden');
240+
}
241+
233242
public function testRequestHistory()
234243
{
235244
$client = $this->getBrowser();

src/Symfony/Component/VarDumper/Caster/SplCaster.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ public static function castObjectStorage(\SplObjectStorage $c, array $a, Stub $s
175175
{
176176
$storage = [];
177177
unset($a[Caster::PREFIX_DYNAMIC."\0gcdata"]); // Don't hit https://bugs.php.net/65967
178+
unset($a["\0SplObjectStorage\0storage"]);
178179

179180
$clone = clone $c;
180181
foreach ($clone as $obj) {

0 commit comments

Comments
 (0)