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

Skip to content < 8000 span data-view-component="true" class="progress-pjax-loader Progress position-fixed width-full">

Commit 23506ce

Browse files
committed
Merge branch '4.4' into 5.4
* 4.4: Fix return type patching for list and class-string pseudo types [HttpKernel] [HttpCache] Don't throw on 304 Not Modified
2 parents 9d83034 + dd947db commit 23506ce

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

src/Symfony/Component/ErrorHandler/DebugClassLoader.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ class DebugClassLoader
7373
'static' => 'static',
7474
'$this' => 'static',
7575
'list' => 'array',
76+
'class-string' => 'string',
7677
];
7778

7879
private const BUILTIN_RETURN_TYPES = [

src/Symfony/Component/HttpKernel/HttpCache/AbstractSurrogate.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public function handle(HttpCache $cache, string $uri, string $alt, bool $ignoreE
9595
try {
9696
$response = $cache->handle($subRequest, HttpKernelInterface::SUB_REQUEST, true);
9797

98-
if (!$response->isSuccessful()) {
98+
if (!$response->isSuccessful() && Response::HTTP_NOT_MODIFIED !== $response->getStatusCode()) {
9999
throw new \RuntimeException(sprintf('Error when rendering "%s" (Status code is %d).', $subRequest->getUri(), $response->getStatusCode()));
100100
}
101101

src/Symfony/Component/HttpKernel/Tests/HttpCache/EsiTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,15 @@ public function testHandleWhenResponseIsNot200AndAltIsPresent()
221221
$this->assertEquals('bar', $esi->handle($cache, '/', '/alt', false));
222222
}
223223

224+
public function testHandleWhenResponseIsNotModified()
225+
{
226+
$esi = new Esi();
227+
$response = new Response('');
228+
$response->setStatusCode(304);
229+
$cache = $this->getCache(Request::create('/'), $response);
230+
$this->assertEquals('', $esi->handle($cache, '/', '/alt', true));
231+
}
232+
224233
protected function getCache($request, $response)
225234
{
226235
$cache = $this->getMockBuilder(HttpCache::class)->setMethods(['getRequest', 'handle'])->disableOriginalConstructor()->getMock();

0 commit comments

Comments
 (0)
0