Skip to content

Commit 964241a

Browse files
Merge branch '4.4' into 5.2
* 4.4: fix tests (ter) Fix tests (bis) [travis] fix travis hopefuly [Security] Fix SerializableUser fixture [FrameworkBundle][WebProfilerBundle] Don't pass null to string parameters
2 parents 2278326 + f2accaa commit 964241a

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

HttpClient/Test/Fixtures/web/index.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
}
3131

3232
$json = json_encode($vars, \JSON_PRETTY_PRINT | \JSON_UNESCAPED_SLASHES | \JSON_UNESCAPED_UNICODE);
33+
$localhost = gethostbyname('localhost');
3334

3435
switch ($vars['REQUEST_URI']) {
3536
default:
@@ -41,7 +42,7 @@
4142

4243
case '/':
4344
case '/?a=a&b=b':
44-
case 'http://127.0.0.1:8057/':
45+
case "http://$localhost:8057/":
4546
case 'http://localhost:8057/':
4647
ob_start('ob_gzhandler');
4748
break;
@@ -74,7 +75,7 @@
7475

7576
case '/301':
7677
if ('Basic Zm9vOmJhcg==' === $vars['HTTP_AUTHORIZATION']) {
77-
header('Location: http://127.0.0.1:8057/302', true, 301);
78+
header("Location: http://$localhost:8057/302", true, 301);
7879
}
7980
break;
8081

HttpClient/Test/HttpClientTestCase.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,7 @@ public function test304()
334334
public function testRedirects()
335335
{
336336
$client = $this->getHttpClient(__FUNCTION__);
337+
$localhost = gethostbyname('localhost');
337338
$response = $client->request('POST', 'http://localhost:8057/301', [
338339
'auth_basic' => 'foo:bar',
339340
'body' => function () {
@@ -351,7 +352,7 @@ public function testRedirects()
351352

352353
$expected = [
353354
'HTTP/1.1 301 Moved Permanently',
354-
'Location: http://127.0.0.1:8057/302',
355+
"Location: http://$localhost:8057/302",
355356
'Content-Type: application/json',
356357
'HTTP/1.1 302 Found',
357358
'Location: http://localhost:8057/',
@@ -424,6 +425,7 @@ public function testRedirect307()
424425
public function testMaxRedirects()
425426
{
426427
$client = $this->getHttpClient(__FUNCTION__);
428+
$localhost = gethostbyname('localhost');
427429
$response = $client->request('GET', 'http://localhost:8057/301', [
428430
'max_redirects' => 1,
429431
'auth_basic' => 'foo:bar',
@@ -441,7 +443,7 @@ public function testMaxRedirects()
441443

442444
$expected = [
443445
'HTTP/1.1 301 Moved Permanently',
444-
'Location: http://127.0.0.1:8057/302',
446+
"Location: http://$localhost:8057/302",
445447
'Content-Type: application/json',
446448
'HTTP/1.1 302 Found',
447449
'Location: http://localhost:8057/',
@@ -690,8 +692,9 @@ public function testOnProgressError()
690692
public function testResolve()
691693
{
692694
$client = $this->getHttpClient(__FUNCTION__);
695+
$localhost = gethostbyname('localhost');
693696
$response = $client->request('GET', 'http://symfony.com:8057/', [
694-
'resolve' => ['symfony.com' => '127.0.0.1'],
697+
'resolve' => ['symfony.com' => $localhost],
695698
]);
696699

697700
$this->assertSame(200, $response->getStatusCode());
@@ -705,15 +708,16 @@ public function testResolve()
705708
public function testIdnResolve()
706709
{
707710
$client = $this->getHttpClient(__FUNCTION__);
711+
$localhost = gethostbyname('localhost');
708712

709713
$response = $client->request('GET', 'http://0-------------------------------------------------------------0.com:8057/', [
710-
'resolve' => ['0-------------------------------------------------------------0.com' => '127.0.0.1'],
714+
'resolve' => ['0-------------------------------------------------------------0.com' => $localhost],
711715
]);
712716

713717
$this->assertSame(200, $response->getStatusCode());
714718

715719
$response = $client->request('GET', 'http://Bücher.example:8057/', [
716-
'resolve' => ['xn--bcher-kva.example' => '127.0.0.1'],
720+
'resolve' => ['xn--bcher-kva.example' => $localhost],
717721
]);
718722

719723
$this->assertSame(200, $response->getStatusCode());
@@ -881,7 +885,7 @@ public function testProxy()
881885

882886
$body = $response->toArray();
883887
$this->assertSame('localhost:8057', $body['HTTP_HOST']);
884-
$this->assertMatchesRegularExpression('#^http://(localhost|127\.0\.0\.1):8057/$#', $body['REQUEST_URI']);
888+
$this->assertMatchesRegularExpression('#^http://(localhost|127\.0\.\d+\.1):8057/$#', $body['REQUEST_URI']);
885889

886890
$response = $client->request('GET', 'http://localhost:8057/', [
887891
'proxy' => 'http://foo:b%3Dar@localhost:8057',

HttpClient/Test/TestHttpServer.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,16 @@ public static function start(int $port = 8057)
2828
});
2929
}
3030

31+
$localhost = gethostbyname('localhost');
3132
$finder = new PhpExecutableFinder();
32-
$process = new Process(array_merge([$finder->find(false)], $finder->findArguments(), ['-dopcache.enable=0', '-dvariables_order=EGPCS', '-S', '127.0.0.1:'.$port]));
33+
$process = new Process(array_merge([$finder->find(false)], $finder->findArguments(), ['-dopcache.enable=0', '-dvariables_order=EGPCS', '-S', "$localhost:$port"]));
3334
$process->setWorkingDirectory(__DIR__.'/Fixtures/web');
3435
$process->start();
3536
self::$process[$port] = $process;
3637

3738
do {
3839
usleep(50000);
39-
} while (!@fopen('http://127.0.0.1:'.$port, 'r'));
40+
} while (!@fopen("http://$localhost:$port", 'r'));
4041

4142
return $process;
4243
}

0 commit comments

Comments
 (0)