Skip to content

Commit

Permalink
Merge branch '3.4' into 4.4
Browse files Browse the repository at this point in the history
* 3.4:
  [VarDumper] fix for change in PHP 7.4.6 (bis)
  [BrowserKit] Allow Referer set by history to be overridden (3.4)
  • Loading branch information
nicolas-grekas committed May 16, 2020
2 parents 1e9486d + cb7e78c commit 94e8c42
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Symfony/Component/BrowserKit/Client.php
Expand Up @@ -380,7 +380,7 @@ public function request(string $method, string $uri, array $parameters = [], arr
$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();
}

Expand Down
Expand Up @@ -230,6 +230,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 = $this->getBrowser();
Expand Down
1 change: 1 addition & 0 deletions src/Symfony/Component/VarDumper/Caster/SplCaster.php
Expand Up @@ -175,6 +175,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) {
Expand Down

0 comments on commit 94e8c42

Please sign in to comment.