8000 Merge branch '6.2' into 6.3 · symfony/symfony@dfe8064 · GitHub
[go: up one dir, main page]

Skip to content

Commit dfe8064

Browse files
Merge branch '6.2' into 6.3
* 6.2: Do not check errored definitions’ type [HttpKernel] Fix restoring surrogate content from cache [HttpKernel] Do not reset lazy services if they are not initialized [HttpClient] Fix getting through proxies via CONNECT Remove legacy filters remnants
2 parents a0b89b6 + 927f408 commit dfe8064

File tree

18 files changed

+185
-93
lines changed

18 files changed

+185
-93
lines changed

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/translation.html.twig

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -153,30 +153,28 @@
153153
</div>
154154
</div>
155155

156-
<script>Sfjs.createFilters();</script>
157-
158156
{% endblock messages %}
159157
{% endif %}
160158

161159
{% endblock %}
162160

163161
{% macro render_table(messages, is_fallback) %}
164-
<table data-filters>
162+
<table>
165163
<thead>
166164
<tr>
167-
<th data-filter="locale">Locale</th>
165+
<th>Locale</th>
168166
{% if is_fallback %}
169167
<th>Fallback locale</th>
170168
{% endif %}
171-
<th data-filter="domain">Domain</th>
169+
<th>Domain</th>
172170
<th>Times used</th>
173171
<th>Message ID</th>
174172
<th>Message Preview</th>
175173
</tr>
176174
</thead>
177175
<tbody>
178176
{% for message in messages %}
179-
<tr data-filter-locale="{{ message.locale }}" data-filter-domain="{{ message.domain }}">
177+
<tr>
180178
<td class="font-normal text-small nowrap">{{ message.locale }}</td>
181179
{% if is_fallback %}
182180
<td class="font-normal text-small nowrap">{{ message.fallbackLocale|default('-') }}</td>

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/profiler.css.twig

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1552,42 +1552,6 @@ tr.status-warning td {
15521552
display: block;
15531553
}
15541554

1555-
{# Filters
1556-
========================================================================= #}
1557-
[data-filters] { position: relative; }
1558-
[data-filtered] { cursor: pointer; }
1559-
[data-filtered]:after { content: '\00a0\25BE'; }
1560-
[data-filtered]:hover .filter-list li { display: inline-flex; }
1561-
[class*="filter-hidden-"] { display: none; }
1562-
.filter-list { position: absolute; border: var(--border); box-shadow: var(--shadow); margin: 0; padding: 0; display: flex; flex-direction: column; }
1563-
.filter-list :after { content: ''; }
1564-
.filter-list li {
1565-
background: var(--tab-disabled-background);
1566-
border-bottom: var(--border);
1567-
color: var(--tab-disabled-color);
1568-
display: none;
1569-
list-style: none;
1570-
margin: 0;
1571-
padding: 5px 10px;
1572-
text-align: left;
1573-
font-weight: normal;
1574-
}
1575-
.filter-list li.active {
1576-
background: var(--tab-background);
1577-
color: var(--tab-color);
1578-
}
1579-
.filter-list li.last-active {
1580-
background: var(--tab-active-background);
1581-
color: var(--tab-active-color);
1582-
}
1583-
1584-
.filter-list-level li { cursor: s-resize; }
1585-
.filter-list-level li.active { cursor: n-resize; }
1586-
.filter-list-level li.last-active { cursor: default; }
1587-
.filter-list-level li.last-active:before { content: '\2714\00a0'; }
1588-
.filter-list-choice li:before { content: '\2714\00a0'; color: transparent; }
1589-
.filter-list-choice li.active:before { color: unset; }
1590-
15911555
{# Badges
15921556
========================================================================= #}
15931557
.badge {

src/Symfony/Component/DependencyInjection/Compiler/CheckTypeDeclarationsPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ private function checkType(Definition $checkedDefinition, mixed $value, \Reflect
213213
$class = null;
214214

215215
if ($value instanceof Definition) {
216-
if ($value->getFactory()) {
216+
if ($value->hasErrors() || $value->getFactory()) {
217217
return;
218218
}
219219

src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckTypeDeclarationsPassTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
use Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag;
2424
use Symfony\Component\DependencyInjection\Reference;
2525
use Symfony\Component\DependencyInjection\Tests\Fixtures\CheckTypeDeclarationsPass\Bar;
26+
use Symfony\Component\DependencyInjection\Tests\Fixtures\CheckTypeDeclarationsPass\BarErroredDependency;
2627
use Symfony\Component\DependencyInjection\Tests\Fixtures\CheckTypeDeclarationsPass\BarMethodCall;
2728
use Symfony\Component\DependencyInjection\Tests\Fixtures\CheckTypeDeclarationsPass\BarOptionalArgument;
2829
use Symfony\Component\DependencyInjection\Tests\Fixtures\CheckTypeDeclarationsPass\BarOptionalArgumentNotNull;
@@ -980,6 +981,20 @@ public function testIgnoreDefinitionFactoryArgument()
980981

981982
$this->addToAssertionCount(1);
982983
}
984+
985+
public function testErroredDefinitionsAreNotChecked()
986+
{
987+
$container = new ContainerBuilder();
988+
$container->register('errored_dependency', BarErroredDependency::class)
989+
->setArguments([
990+
(new Definition(Foo::class))
991+
->addError('error'),
992+
]);
993+
994+
(new CheckTypeDeclarationsPass(true))->process($container);
995+
996+
$this->addToAssertionCount(1);
997+
}
983998
}
984999

9851000
class CallableClass
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
namespace Symfony\Component\DependencyInjection\Tests\Fixtures\CheckTypeDeclarationsPass;
4+
5+
class BarErroredDependency
6+
{
7+
public function __construct(\stdClass $foo)
8+
{
9+
}
10+
}

src/Symfony/Component/HttpClient/Response/AmpResponse.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ final class AmpResponse implements ResponseInterface, StreamableInterface
4747

4848
private AmpClientState $multi;
4949
private ?array $options;
50-
private CancellationTokenSource $canceller;
5150
private \Closure $onProgress;
5251

5352
private static ?string $delay = null;
@@ -71,7 +70,7 @@ public function __construct(AmpClientState $multi, Request $request, array $opti
7170

7271
$info = &$this->info;
7372
$headers = &$this->headers;
74-
$canceller = $this->canceller = new CancellationTokenSource();
73+
$canceller = new CancellationTokenSource();
7574
$handle = &$this->handle;
7675

7776
$info['url'] = (string) $request->getUri();

src/Symfony/Component/HttpClient/Response/CurlResponse.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -79,17 +79,7 @@ public function __construct(CurlClientState $multi, \CurlHandle|string $ch, arra
7979
}
8080

8181
curl_setopt($ch, \CURLOPT_HEADERFUNCTION, static function ($ch, string $data) use (&$info, &$headers, $options, $multi, $id, &$location, $resolveRedirect, $logger): int {
82-
if (0 !== substr_compare($data, "\r\n", -2)) {
83-
return 0;
84-
}
85-
86-
$len = 0;
87-
88-
foreach (explode("\r\n", substr($data, 0, -2)) as $data) {
89-
$len += 2 + self::parseHeaderLine($ch, $data, $info, $headers, $options, $multi, $id, $location, $resolveRedirect, $logger);
90-
}
91-
92-
return $len;
82+
return self::parseHeaderLine($ch, $data, $info, $headers, $options, $multi, $id, $location, $resolveRedirect, $logger);
9383
});
9484

9585
if (null === $options) {
@@ -366,19 +356,29 @@ private static function select(ClientState $multi, float $timeout): int
366356
*/
367357
private static function parseHeaderLine($ch, string $data, array &$info, array &$headers, ?array $options, CurlClientState $multi, int $id, ?string &$location, ?callable $resolveRedirect, ?LoggerInterface $logger): int
368358
{
359+
if (!str_ends_with($data, "\r\n")) {
360+
return 0;
361+
}
362+
369363
$waitFor = @curl_getinfo($ch, \CURLINFO_PRIVATE) ?: '_0';
370364

371365
if ('H' !== $waitFor[0]) {
372366
return \strlen($data); // Ignore HTTP trailers
373367
}
374368

375-
if ('' !== $data) {
369+
$statusCode = curl_getinfo($ch, \CURLINFO_RESPONSE_CODE);
370+
371+
if ($statusCode !== $info['http_code'] && !preg_match("#^HTTP/\d+(?:\.\d+)? {$statusCode}(?: |\r\n$)#", $data)) {
372+
return \strlen($data); // Ignore headers from responses to CONNECT requests
373+
}
374+
375+
if ("\r\n" !== $data) {
376376
// Regular header line: add it to the list
377-
self::addResponseHeaders([$data], $info, $headers);
377+
self::addResponseHeaders([substr($data, 0, -2)], $info, $headers);
378378

379379
if (!str_starts_with($data, 'HTTP/')) {
380380
if (0 === stripos($data, 'Location:')) {
381-
$location = trim(substr($data, 9));
381+
$location = trim(substr($data, 9, -2));
382382
}
383383

384384
return \strlen($data);
@@ -401,7 +401,7 @@ private static function parseHeaderLine($ch, string $data, array &$info, array &
401401

402402
// End of headers: handle informational responses, redirects, etc.
403403

404-
if (200 > $statusCode = curl_getinfo($ch, \CURLINFO_RESPONSE_CODE)) {
404+
if (200 > $statusCode) {
405405
$multi->handlesActivity[$id][] = new InformationalChunk($statusCode, $headers);
406406
$location = null;
407407

src/Symfony/Component/HttpKernel/DependencyInjection/ServicesResetter.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
1212
namespace Symfony\Component\HttpKernel\DependencyInjection;
1313

14+
use ProxyManager\Proxy\LazyLoadingInterface;
15+
use Symfony\Component\VarExporter\LazyObjectInterface;
1416
use Symfony\Contracts\Service\ResetInterface;
1517

1618
/**
@@ -39,6 +41,14 @@ public function __construct(\Traversable $resettableServices, array $resetMethod
3941
public function reset(): void
4042
{
4143
foreach ($this->resettableServices as $id => $service) {
44+
if ($service instanceof LazyObjectInterface && !$service->isLazyObjectInitialized(true)) {
45+
continue;
46+
}
47+
48+
if ($service instanceof LazyLoadingInterface && !$service->isProxyInitialized()) {
49+
continue;
50+
}
51+
4252
foreach ((array) $this->resetMethods[$id] as $resetMethod) {
4353
if ('?' === $resetMethod[0] && !method_exists($service, $resetMethod = substr($resetMethod, 1))) {
4454
continue;

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,4 +128,15 @@ protected function removeFromControl(Response $response)
128128
$response->headers->set('Surrogate-Control', preg_replace(sprintf('#content="%s/1.0",\s*#', $upperName), '', $value));
129129
}
130130
}
131+
132+
protected static function generateBodyEvalBoundary(): string
133+
{
134+
static $cookie;
135+
$cookie = hash('xxh128', $cookie ?? $cookie = random_bytes(16), true);
136+
$boundary = base64_encode($cookie);
137+
138+
\assert(HttpCache::BODY_EVAL_BOUNDARY_LENGTH === \strlen($boundary));
139+
140+
return $boundary;
141+
}
131142
}

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,7 @@ public function process(Request $request, Response $response): Response
7474
$content = preg_replace('#<esi\:remove>.*?</esi\:remove>#s', '', $content);
7575
$content = preg_replace('#<esi\:comment[^>]+>#s', '', $content);
7676

77-
static $cookie;
78-
$cookie = hash('xxh128', $cookie ??= random_bytes(16), true);
79-
$boundary = base64_encode($cookie);
77+
$boundary = self::generateBodyEvalBoundary();
8078
$chunks = preg_split('#<esi\:include\s+(.*?)\s*(?:/|</esi\:include)>#', $content, -1, \PREG_SPLIT_DELIM_CAPTURE);
8179

8280
$i = 1;

0 commit comments

Comments
 (0)
0