10000 Merge branch '4.4' into 5.4 · symfony/symfony@8497822 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8497822

Browse files
Merge branch '4.4' into 5.4
* 4.4: [Bridge] Fix mkdir() race condition in ProxyCacheWarmer [Cache] update readme Psr18Client ignore invalid HTTP headers skip a transient test on AppVeyor
2 parents 8b17626 + b5a40b7 commit 8497822

File tree

6 files changed

+37
-9
lines changed

6 files changed

+37
-9
lines changed

src/Symfony/Bridge/Doctrine/CacheWarmer/ProxyCacheWarmer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function warmUp(string $cacheDir)
5252
foreach ($this->registry->getManagers() as $em) {
5353
// we need the directory no matter the proxy cache generation strategy
5454
if (!is_dir($proxyCacheDir = $em->getConfiguration()->getProxyDir())) {
55-
if (false === @mkdir($proxyCacheDir, 0777, true)) {
55+
if (false === @mkdir($proxyCacheDir, 0777, true) && !is_dir($proxyCacheDir)) {
5656
throw new \RuntimeException(sprintf('Unable to create the Doctrine Proxy directory "%s".', $proxyCacheDir));
5757
}
5858
} elseif (!is_writable($proxyCacheDir)) {

src/Symfony/Component/Cache/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
Symfony PSR-6 implementation for caching
22
========================================
33

4-
The Cache component provides an extended
5-
[PSR-6](http://www.php-fig.org/psr/psr-6/) implementation for adding cache to
4+
The Cache component provides extended
5+
[PSR-6](https://www.php-fig.org/psr/psr-6/) implementations for adding cache to
66
your applications. It is designed to have a low overhead so that caching is
7-
fastest. It ships with a few caching adapters for the most widespread and
8-
suited to caching backends. It also provides a `doctrine/cache` proxy adapter
9-
to cover more advanced caching needs and a proxy adapter for greater
10-
interoperability between PSR-6 implementations.
7+
fastest. It ships with adapters for the most widespread caching backends.
8+
It also provides a [PSR-16](https://www.php-fig.org/psr/psr-16/) adapter,
9+
and implementations for [symfony/cache-contracts](https://github.com/symfony/cache-contracts)'
10+
`CacheInterface` and `TagAwareCacheInterface`.
1111

1212
Resources
1313
---------

src/Symfony/Component/Cache/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "symfony/cache",
33
"type": "library",
4-
"description": "Provides an extended PSR-6, PSR-16 (and tags) implementation",
4+
"description": "Provides extended PSR-6, PSR-16 (and tags) implementations",
55
"keywords": ["caching", "psr6"],
66
"homepage": "https://symfony.com",
77
"license": "MIT",

src/Symfony/Component/HttpClient/Psr18Client.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,11 @@ public function sendRequest(RequestInterface $request): ResponseInterface
101101

102102
foreach ($response->getHeaders(false) as $name => $values) {
103103
foreach ($values as $value) {
104-
$psrResponse = $psrResponse->withAddedHeader($name, $value);
104+
try {
105+
$psrResponse = $psrResponse->withAddedHeader($name, $value);
106+
} catch (\InvalidArgumentException $e) {
107+
// ignore invalid header
108+
}
105109
}
106110
}
107111

src/Symfony/Component/HttpClient/Tests/Psr18ClientTest.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@
1313

1414
use Nyholm\Psr7\Factory\Psr17Factory;
1515
use PHPUnit\Framework\TestCase;
16+
use Symfony\Component\HttpClient\MockHttpClient;
1617
use Symfony\Component\HttpClient\NativeHttpClient;
1718
use Symfony\Component\HttpClient\Psr18Client;
1819
use Symfony\Component\HttpClient\Psr18NetworkException;
1920
use Symfony\Component\HttpClient\Psr18RequestException;
21+
use Symfony\Component\HttpClient\Response\MockResponse;
2022
use Symfony\Contracts\HttpClient\Test\TestHttpServer;
2123

2224
class Psr18ClientTest extends TestCase
@@ -81,4 +83,22 @@ public function test404()
8183
$response = $client->sendRequest($factory->createRequest('GET', 'http://localhost:8057/404'));
8284
$this->assertSame(404, $response->getStatusCode());
8385
}
86+
87+
public function testInvalidHeaderResponse()
88+
{
89+
$responseHeaders = [
90+
// space in header name not allowed in RFC 7230
91+
' X-XSS-Protection' => '0',
92+
'Cache-Control' => 'no-cache',
93+
];
94+
$response = new MockResponse('body', ['response_headers' => $responseHeaders]);
95+
$this->assertArrayHasKey(' x-xss-protection', $response->getHeaders());
96+
97+
$client = new Psr18Client(new MockHttpClient($response));
98+
$request = $client->createRequest('POST', 'http://localhost:8057/post')
99+
->withBody($client->createStream('foo=0123456789'));
100+
101+
$resultResponse = $client->sendRequest($request);
102+
$this->assertCount(1, $resultResponse->getHeaders());
103+
}
84104
}

src/Symfony/Component/VarDumper/Tests/Dumper/ServerDumperTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ public function testDumpForwardsToWrappedDumperWhenServerIsUnavailable()
3939

4040
public function testDump()
4141
{
< 5F2C /td>42+
if ('True' === getenv('APPVEYOR')) {
43+
$this->markTestSkipped('Skip transient test on AppVeyor');
44+
}
45+
4246
$wrappedDumper = $this->createMock(DataDumperInterface::class);
4347
$wrappedDumper->expects($this->never())->method('dump'); // test wrapped dumper is not used
4448

0 commit comments

Comments
 (0)
0