Skip to content

Commit 4f97f25

Browse files
Merge branch '6.3' into 6.4
* 6.3: [Cache] Fix Redis6Proxy [Finder] Disable failing test about open_basedir Fix merge Fix merge [Notifier] Telegram Bridge add escaping for \ [Routing] Fix routing collection defaults when adding a new route to a collection [Messenger] Fix cloned TraceableStack not unstacking the stack independently [DependencyInjection] Fix autocasting null env values to empty string with container.env_var_processors_locator [Cache] Fix support for Redis Sentinel using php-redis 6.0.0 [Notifier] Fix Smsmode HttpClient mandatory headers minor #51693 Disable the dead code analysis in Psalm (stof) Update the PR template [SecurityBundle][PasswordHasher] Fix password migration with custom hasher service with security bundle config [Translator] Fix support for `default_path` in XML [FrameworkBundle] Handle tags array attributes in descriptors [HttpClient] Fix TraceableResponse if response has no destruct method [FrameworkBundle] Always use buildDir as `ConfigBuilderGenerator` outputDir
2 parents a943a58 + f1e2c3a commit 4f97f25

28 files changed

+328
-67
lines changed

CacheWarmer/ConfigBuilderCacheWarmer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function __construct(KernelInterface $kernel, LoggerInterface $logger = n
4242
*/
4343
public function warmUp(string $cacheDir): array
4444
{
45-
$generator = new ConfigBuilderGenerator($cacheDir);
45+
$generator = new ConfigBuilderGenerator($this->kernel->getBuildDir());
4646

4747
foreach ($this->kernel->getBundles() as $bundle) {
4848
$extension = $bundle->getContainerExtension();

Console/Descriptor/MarkdownDescriptor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ protected function describeContainerDefinition(Definition $definition, array $op
254254
foreach ($tagData as $parameters) {
255255
$output .= "\n".'- Tag: `'.$tagName.'`';
256256
foreach ($parameters as $name => $value) {
257-
$output .= "\n".' - '.ucfirst($name).': '.$value;
257+
$output .= "\n".' - '.ucfirst($name).': '.(\is_array($value) ? $this->formatParameter($value) : $value);
258258
}
259259
}
260260
}

Console/Descriptor/TextDescriptor.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,10 @@ protected function describeContainerServices(ContainerBuilder $container, array
209209
if (!isset($maxTags[$key])) {
210210
$maxTags[$key] = \strlen($key);
211211
}
212+
if (\is_array($value)) {
213+
$value = $this->formatParameter($value);
214+
}
215+
212216
if (\strlen($value) > $maxTags[$key]) {
213217
$maxTags[$key] = \strlen($value);
214218
}
@@ -233,7 +237,11 @@ protected function describeContainerServices(ContainerBuilder $container, array
233237
foreach ($this->sortByPriority($definition->getTag($showTag)) as $key => $tag) {
234238
$tagValues = [];
235239
foreach ($tagsNames as $tagName) {
236-
$tagValues[] = $tag[$tagName] ?? '';
240+
if (\is_array($tagValue = $tag[$tagName] ?? '')) {
241+
$tagValue = $this->formatParameter($tagValue);
242+
}
243+
244+
$tagValues[] = $tagValue;
237245
}
238246
if (0 === $key) {
239247
$tableRows[] = array_merge([$serviceId], $tagValues, [$definition->getClass()]);
@@ -275,7 +283,7 @@ protected function describeContainerDefinition(Definition $definition, array $op
275283
$tagInformation = [];
276284
foreach ($tags as $tagName => $tagData) {
277285
foreach ($tagData as $tagParameters) {
278-
$parameters = array_map(fn ($key, $value) => sprintf('<info>%s</info>: %s', $key, $value), array_keys($tagParameters), array_values($tagParameters));
286+
$parameters = array_map(fn ($key, $value) => sprintf('<info>%s</info>: %s', $key, \is_array($value) ? $this->formatParameter($value) : $value), array_keys($tagParameters), array_values($tagParameters));
279287
$parameters = implode(', ', $parameters);
280288

281289
if ('' === $parameters) {

Resources/config/schema/symfony-1.0.xsd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@
237237
<xsd:attribute name="logging" type="xsd:boolean" />
238238
<xsd:attribute name="formatter" type="xsd:string" />
239239
<xsd:attribute name="cache-dir" type="xsd:string" />
240+
<xsd:attribute name="default-path" type="xsd:string" />
240241
</xsd:complexType>
241242

242243
<xsd:complexType name="pseudo_localization">
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Bundle\FrameworkBundle\Tests\CacheWarmer;
13+
14+
use Symfony\Bundle\FrameworkBundle\CacheWarmer\ConfigBuilderCacheWarmer;
15+
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
16+
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
17+
use Symfony\Component\Config\Loader\LoaderInterface;
18+
use Symfony\Component\Filesystem\Filesystem;
19+
use Symfony\Component\HttpKernel\Kernel;
20+
21+
class ConfigBuilderCacheWarmerTest extends TestCase
22+
{
23+
private $varDir;
24+
25+
protected function setUp(): void
26+
{
27+
$this->varDir = sys_get_temp_dir().'/'.uniqid();
28+
$fs = new Filesystem();
29+
$fs->mkdir($this->varDir);
30+
}
31+
32+
protected function tearDown(): void
33+
{
34+
$fs = new Filesystem();
35+
$fs->remove($this->varDir);
36+
unset($this->varDir);
37+
}
38+
39+
public function testBuildDirIsUsedAsConfigBuilderOutputDir()
40+
{
41+
$kernel = new class($this->varDir) extends Kernel {
42+
private $varDir;
43+
44+
public function __construct(string $varDir)
45+
{
46+
parent::__construct('test', false);
47+
48+
$this->varDir = $varDir;
49+
}
50+
51+
public function registerBundles(): iterable
52+
{
53+
yield new FrameworkBundle();
54+
}
55+
56+
public function getBuildDir(): string
57+
{
58+
return $this->varDir.'/build';
59+
}
60+
61+
public function getCacheDir(): string
62+
{
63+
return $this->varDir.'/cache';
64+
}
65+
66+
public function registerContainerConfiguration(LoaderInterface $loader)
67+
{
68+
}
69+
};
70+
$kernel->boot();
71+
72+
$warmer = new ConfigBuilderCacheWarmer($kernel);
73+
$warmer->warmUp($kernel->getCacheDir());
74+
75+
self::assertDirectoryExists($kernel->getBuildDir().'/Symfony');
76+
self::assertDirectoryDoesNotExist($kernel->getCacheDir().'/Symfony');
77+
}
78+
}

Tests/Console/Descriptor/ObjectsProvider.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ public static function getContainerDefinitions()
169169
->addTag('tag1', ['attr1' => 'val1', 'attr2' => 'val2'])
170170
->addTag('tag1', ['attr3' => 'val3'])
171171
->addTag('tag2')
172+
->addTag('tag3', ['array_attr' => ['foo', 'bar', [[[['ccc']]]]]])
172173
->addMethodCall('setMailer', [new Reference('mailer')])
173174
->setFactory([new Reference('factory.service'), 'get']),
174175
'.definition_3' => $definition3

Tests/Fixtures/Descriptor/alias_with_definition_2.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,24 @@
3636
{
3737
"name": "tag2",
3838
"parameters": []
39+
},
40+
{
41+
"name": "tag3",
42+
"parameters": {
43+
"array_attr": [
44+
"foo",
45+
"bar",
46+
[
47+
[
48+
[
49+
[
50+
"ccc"
51+
]
52+
]
53+
]
54+
]
55+
]
56+
}
3957
}
4058
],
4159
"usages": [

Tests/Fixtures/Descriptor/alias_with_definition_2.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,6 @@
2424
- Tag: `tag1`
2525
- Attr3: val3
2626
- Tag: `tag2`
27+
- Tag: `tag3`
28+
- Array_attr: ["foo","bar",[[[["ccc"]]]]]
2729
- Usages: .alias_2

Tests/Fixtures/Descriptor/alias_with_definition_2.txt

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,26 @@
33
Information for Service ".service_2"
44
====================================
55

6-
----------------- ---------------------------------
7-
 Option   Value 
8-
----------------- ---------------------------------
9-
Service ID .service_2
10-
Class Full\Qualified\Class2
11-
Tags tag1 (attr1: val1, attr2: val2)
12-
tag1 (attr3: val3)
13-
tag2
14-
Calls setMailer
15-
Public no
16-
Synthetic yes
17-
Lazy no
18-
Shared yes
19-
Abstract no
20-
Autowired no
21-
Autoconfigured no
22-
Required File /path/to/file
23-
Factory Service factory.service
24-
Factory Method get
25-
Usages .alias_2
26-
----------------- ---------------------------------
6+
----------------- ------------------------------------------------
7+
 Option   Value 
8+
----------------- ------------------------------------------------
9+
Service ID .service_2
10+
Class Full\Qualified\Class2
11+
Tags tag1 (attr1: val1, attr2: val2)
12+
tag1 (attr3: val3)
13+
tag2
14+
tag3 (array_attr: ["foo","bar",[[[["ccc"]]]]])
15+
Calls setMailer
16+
Public no
17+
Synthetic yes
18+
Lazy no
19+
Shared yes
20+
Abstract no
21+
Autowired no
22+
Autoconfigured no
23+
Required File /path/to/file
24+
Factory Service factory.service
25+
Factory Method get
26+
Usages .alias_2
27+
----------------- ------------------------------------------------
28+

Tests/Fixtures/Descriptor/alias_with_definition_2.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
<parameter name="attr3">val3</parameter>
1515
</tag>
1616
<tag name="tag2"/>
17+
<tag name="tag3">
18+
<parameter name="array_attr">["foo","bar",[[[["ccc"]]]]]</parameter>
19+
</tag>
1720
</tags>
1821
<usages>
1922
<usage>.alias_2</usage>

0 commit comments

Comments
 (0)