10000 Merge branch '7.1' into 7.2 · symfony/symfony@e314213 · GitHub
[go: up one dir, main page]

Skip to content

Commit e314213

Browse files
committed
Merge branch '7.1' into 7.2
* 7.1: Fix Twig deprecation notice [Serializer] Fix CamelCaseToSnakeCaseNameConverterTest::testDenormalizeWithContext [DependencyInjection] Fix issue between decorator and service locator index [AssetMapper] Fix JsDeliver import regexp do not overwrite the host to request
2 parents c3bb47a + 49d41a7 commit e314213

File tree

8 files changed

+37
-9
lines changed

8 files changed

+37
-9
lines changed

src/Symfony/Bridge/Twig/Tests/NodeVisitor/TwigNodeProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class TwigNodeProvider
2828
public static function getModule($content)
2929
{
3030
return new ModuleNode(
31-
new ConstantExpression($content, 0),
31+
new BodyNode([new ConstantExpression($content, 0)]),
3232
null,
3333
new ArrayExpression([], 0),
3434
new ArrayExpression([], 0),

src/Symfony/Component/AssetMapper/ImportMap/Resolver/JsDelivrEsmResolver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ final class JsDelivrEsmResolver implements PackageResolverInterface
2828
public const URL_PATTERN_DIST = self::URL_PATTERN_DIST_CSS.'/+esm';
2929
public const URL_PATTERN_ENTRYPOINT = 'https://data.jsdelivr.com/v1/packages/npm/%s@%s/entrypoints';
3030

31-
public const IMPORT_REGEX = '#(?:import\s*(?:\w+,)?(?:(?:\{[^}]*\}|\w+|\*\s*as\s+\w+)\s*\bfrom\s*)?|export\s*(?:\{[^}]*\}|\*)\s*from\s*)("/npm/((?:@[^/]+/)?[^@]+?)(?:@([^/]+))?((?:/[^/]+)*?)/\+esm")#';
31+
public const IMPORT_REGEX = '#(?:import\s*(?:[\w$]+,)?(?:(?:\{[^}]*\}|[\w$]+|\*\s*as\s+[\w$]+)\s*\bfrom\s*)?|export\s*(?:\{[^}]*\}|\*)\s*from\s*)("/npm/((?:@[^/]+/)?[^@]+?)(?:@([^/]+))?((?:/[^/]+)*?)/\+esm")#';
3232

3333
private const ES_MODULE_SHIMS = 'es-module-shims';
3434

src/Symfony/Component/AssetMapper/Tests/ImportMap/Resolver/JsDelivrEsmResolverTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -686,6 +686,13 @@ public static function provideImportRegex(): iterable
686686
['datatables.net-select', '1.7.0'],
687687
],
688688
];
689+
690+
yield 'import with name containing a dollar sign' => [
691+
'import jQuery$1 from "/npm/jquery@3.7.0/+esm";',
692+
[
693+
['jquery', '3.7.0'],
694+
],
695+
];
689696
}
690697

691698
private static function createRemoteEntry(string $importName, string $version, ImportMapType $type = ImportMapType::JS, ?string $packageSpecifier = null): ImportMapEntry

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ private function findAndSortTaggedServices(string|TaggedIteratorArgument $tagNam
8585
} elseif (null === $defaultIndex && $defaultPriorityMethod && $class) {
8686
$defaultIndex = PriorityTaggedServiceUtil::getDefault($container, $serviceId, $class, $defaultIndexMethod ?? 'getDefaultName', $tagName, $indexAttribute, $checkTaggedItem);
8787
}
88-
$index ??= $defaultIndex ??= $serviceId;
88+
$decorated = $definition->getTag('container.decorator')[0]['id'] ?? null;
89+
$index = $index ?? $defaultIndex ?? $defaultIndex = $decorated ?? $serviceId;
8990

9091
$services[] = [$priority, ++$i, $index, $serviceId, $class];
9192
}

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,9 @@ public function testTheIndexedTagsByDefaultIndexMethod()
153153

154154
$container->register('service4', HelloInterface::class)->addTag('my_custom_tag');
155155

156+
$definition = $container->register('debug.service5', \stdClass::class)->addTag('my_custom_tag');
157+
$definition->addTag('container.decorator', ['id' => 'service5']);
158+
156159
$priorityTaggedServiceTraitImplementation = new PriorityTaggedServiceTraitImplementation();
157160

158161
$tag = new TaggedIteratorArgument('my_custom_tag', 'foo', 'getFooBar');
@@ -161,6 +164,7 @@ public function testTheIndexedTagsByDefaultIndexMethod()
161164
'service1' => new TypedReference('service1', FooTagClass::class),
162165
'10' => new TypedReference('service3', IntTagClass::class),
163166
'service4' => new TypedReference('service4', HelloInterface::class),
167+
'service5' => new TypedReference('debug.service5', \stdClass::class),
164168
];
165169
$services = $priorityTaggedServiceTraitImplementation->test($tag, $container);
166170
$this->assertSame(array_keys($expected), array_keys($services));

src/Symfony/Component/HttpClient/CurlHttpClient.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,10 +188,10 @@ public function request(string $method, string $url, array $options = []): Respo
188188
$multi->reset();
189189
}
190190

191-
foreach ($options['resolve'] as $host => $ip) {
192-
$resolve[] = null === $ip ? "-$host:$port" : "$host:$port:$ip";
193-
$multi->dnsCache->hostnames[$host] = $ip;
194-
$multi->dnsCache->removals["-$host:$port"] = "-$host:$port";
191+
foreach ($options['resolve'] as $resolveHost => $ip) {
192+
$resolve[] = null === $ip ? "-$resolveHost:$port" : "$resolveHost:$port:$ip";
193+
$multi->dnsCache->hostnames[$resolveHost] = $ip;
194+
$multi->dnsCache->removals["-$resolveHost:$port"] = "-$resolveHost:$port";
195195
}
196196

197197
$curlopts[\CURLOPT_RESOLVE] = $resolve;

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,4 +122,20 @@ public function testOverridingInternalAttributesUsingCurlOptions()
122122
],
123123
]);
124124
}
125+
126+
public function testKeepAuthorizationHeaderOnRedirectToSameHostWithConfiguredHostToIpAddressMapping()
127+
{
128+
$httpClient = $this->getHttpClient(__FUNCTION__);
129+
$response = $httpClient->request('POST', 'http://127.0.0.1:8057/301', [
130+
'headers' => [
131+
'Authorization' => 'Basic Zm9vOmJhcg==',
132+
],
133+
'resolve' => [
134+
'symfony.com' => '10.10.10.10',
135+
],
136+
]);
137+
138+
$this->assertSame(200, $response->getStatusCode());
139+
$this->assertSame('/302', $response->toArray()['REQUEST_URI'] ?? null);
140+
}
125141
}

src/Symfony/Component/Serializer/Tests/NameConverter/CamelCaseToSnakeCaseNameConverterTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ public static function attributeProvider()
6161
public function testDenormalizeWithContext()
6262
{
6363
$nameConverter = new CamelCaseToSnakeCaseNameConverter(null, true);
64-
$denormalizedValue = $nameConverter->denormalize('last_name', null, null, [CamelCaseToSnakeCaseNameConverter::REQUIRE_SNAKE_CASE_PROPERTIES]);
64+
$denormalizedValue = $nameConverter->denormalize('last_name', null, null, [CamelCaseToSnakeCaseNameConverter::REQUIRE_SNAKE_CASE_PROPERTIES => true]);
6565

66-
$this->assertSame($denormalizedValue, 'lastName');
66+
$this->assertSame('lastName', $denormalizedValue);
6767
}
6868

6969
public function testErrorDenormalizeWithContext()

0 commit comments

Comments
 (0)
0