Skip to content

Commit 8613ff6

Browse files
Merge branch '6.2' into 6.3
* 6.2: [VarDumper] Fix calling scope detection inside magic accessors [Validator] add missing German translations [Serializer] Fix denormalizing abstract part headers in MimeMessageNormalizer [Form] Remove an obsolete phpdoc comment [FrameworkBundle][Workflow] Throw exception is workflow.xxx.transitions is not an array
2 parents d9d0bde + ce2a25e commit 8613ff6

File tree

10 files changed

+111
-12
lines changed

10 files changed

+111
-12
lines changed

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php

+8
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,10 @@ private function addWorkflowSection(ArrayNodeDefinition $rootNode): void
465465
->beforeNormalization()
466466
->always()
467467
->then(function ($places) {
468+
if (!\is_array($places)) {
469+
throw new InvalidConfigurationException('The "places" option must be an array in workflow configuration.');
470+
}
471+
468472
// It's an indexed array of shape ['place1', 'place2']
469473
if (isset($places[0]) && \is_string($places[0])) {
470474
return array_map(function (string $place) {
@@ -510,6 +514,10 @@ private function addWorkflowSection(ArrayNodeDefinition $rootNode): void
510514
->beforeNormalization()
511515
->always()
512516
->then(function ($transitions) {
517+
if (!\is_array($transitions)) {
518+
throw new InvalidConfigurationException('The "transitions" option must be an array in workflow configuration.');
519+
}
520+
513521
// It's an indexed array, we let the validation occur
514522
if (isset($transitions[0]) && \is_array($transitions[0])) {
515523
return $transitions;

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/PhpFrameworkExtensionTest.php

+31
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection;
1313

14+
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
1415
use Symfony\Component\Config\FileLocator;
1516
use Symfony\Component\DependencyInjection\ContainerBuilder;
1617
use Symfony\Component\DependencyInjection\Exception\LogicException;
@@ -58,6 +59,36 @@ public function testAssetPackageCannotHavePathAndUrl()
5859
});
5960
}
6061

62+
public function testWorkflowValidationPlacesIsArray()
63+
{
64+
$this->expectException(InvalidConfigurationException::class);
65+
$this->expectExceptionMessage('The "places" option must be an array in workflow configuration.');
66+
$this->createContainerFromClosure(function ($container) {
67+
$container->loadFromExtension('framework', [
68+
'workflows' => [
69+
'article' => [
70+
'places' => null,
71+
],
72+
],
73+
]);
74+
});
75+
}
76+
77+
public function testWorkflowValidationTransitonsIsArray()
78+
{
79+
$this->expectException(InvalidConfigurationException::class);
80+
$this->expectExceptionMessage('The "transitions" option must be an array in workflow configuration.');
81+
$this->createContainerFromClosure(function ($container) {
82+
$container->loadFromExtension('framework', [
83+
'workflows' => [
84+
'article' => [
85+
'transitions' => null,
86+
],
87+
],
88+
]);
89+
});
90+
}
91+
6192
public function testWorkflowValidationStateMachine()
6293
{
6394
$this->expectException(InvalidDefinitionException::class);

src/Symfony/Component/Form/FormTypeGuesserInterface.php

-7
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,6 @@ public function guessMaxLength(string $class, string $property);
4040
/**
4141
* Returns a guess about the field's pattern.
4242
*
43-
* - When you have a min value, you guess a min length of this min (LOW_CONFIDENCE)
44-
* - Then line below, if this value is a float type, this is wrong so you guess null with MEDIUM_CONFIDENCE to override the previous guess.
45-
* Example:
46-
* You want a float greater than 5, 4.512313 is not valid but length(4.512314) > length(5)
47-
*
48-
* @see https://github.com/symfony/symfony/pull/3927
49-
*
5043
* @return Guess\ValueGuess|null
5144
*/
5245
public function guessPattern(string $class, string $property);

src/Symfony/Component/Mime/Tests/MessageTest.php

+13-2
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ public function testSymfonySerialize()
168168
),
169169
new DataPart('text data', 'text.txt')
170170
);
171+
$body->getHeaders()->addHeader('foo', 'bar');
171172
$e = new Message((new Headers())->addMailboxListHeader('To', ['you@example.com']), $body);
172173
$expected = clone $e;
173174

@@ -232,7 +233,17 @@ public function testSymfonySerialize()
232233
"class": "Symfony\\\\Component\\\\Mime\\\\Part\\\\DataPart"
233234
}
234235
],
235-
"headers": [],
236+
"headers": {
237+
"foo": [
238+
{
239+
"value": "bar",
240+
"name": "foo",
241+
"lineLength": 76,
242+
"lang": null,
243+
"charset": "utf-8"
244+
}
245+
]
246+
},
236247
"class": "Symfony\\\\Component\\\\Mime\\\\Part\\\\Multipart\\\\MixedPart"
237248
},
238249
"message": null
@@ -252,7 +263,7 @@ public function testSymfonySerialize()
252263
$this->assertStringMatchesFormat($expectedJson, json_encode(json_decode($serialized), \JSON_PRETTY_PRINT | \JSON_UNESCAPED_SLASHES));
253264

254265
$n = $serializer->deserialize($serialized, Message::class, 'json');
255-
$this->assertEquals($expected->getHeaders(), $n->getHeaders());
266+
$this->assertEquals($expected, $n);
256267

257268
$serialized = $serializer->serialize($e, 'json');
258269
$this->assertStringMatchesFormat($expectedJson, json_encode(json_decode($serialized), \JSON_PRETTY_PRINT | \JSON_UNESCAPED_SLASHES));

src/Symfony/Component/Mime/composer.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@
2727
"symfony/dependency-injection": "^5.4|^6.0",
2828
"symfony/property-access": "^5.4|^6.0",
2929
"symfony/property-info": "^5.4|^6.0",
30-
"symfony/serializer": "^6.2"
30+
"symfony/serializer": "^6.2.13"
3131
},
3232
"conflict": {
3333
"egulias/email-validator": "~3.0.0",
3434
"phpdocumentor/reflection-docblock": "<3.2.2",
3535
"phpdocumentor/type-resolver": "<1.4.0",
3636
"symfony/mailer": "<5.4",
37-
"symfony/serializer": "<6.2"
37+
"symfony/serializer": "<6.2.13"
3838
},
3939
"autoload": {
4040
"psr-4": { "Symfony\\Component\\Mime\\": "" },

src/Symfony/Component/Serializer/Normalizer/MimeMessageNormalizer.php

+1
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ public function denormalize(mixed $data, string $type, string $format = null, ar
101101
if (AbstractPart::class === $type) {
102102
$type = $data['class'];
103103
unset($data['class']);
104+
$data['headers'] = $this->serializer->denormalize($data['headers'], Headers::class, $format, $context);
104105
}
105106

106107
return $this->normalizer->denormalize($data, $type, $format, $context);

src/Symfony/Component/Validator/Resources/translations/validators.de.xlf

+20
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,26 @@
406406
<source>The filename is too long. It should have {{ filename_max_length }} character or less.|The filename is too long. It should have {{ filename_max_length }} characters or less.</source>
407407
<target>Der Dateiname ist zu lang. Er sollte nicht länger als {{ filename_max_length }} Zeichen sein.|Der Dateiname ist zu lang. Er sollte nicht länger als {{ filename_max_length }} Zeichen sein.</target>
408408
</trans-unit>
409+
<trans-unit id="105">
410+
<source>The password strength is too low. Please use a stronger password.</source>
411+
<target>Das Passwort ist zu schwach.</target>
412+
</trans-unit>
413+
<trans-unit id="106">
414+
<source>This value contains characters that are not allowed by the current restriction-level.</source>
415+
<target>Der Wert enthält Zeichen, die auf der aktuellen Einschränkungsstufe nicht erlaubt sind.</target>
416+
</trans-unit>
417+
<trans-unit id="107">
418+
<source>Using invisible characters is not allowed.</source>
419+
<target>Unsichtbare Zeichen sind nicht erlaubt.</target>
420+
</trans-unit>
421+
<trans-unit id="108">
422+
<source>Mixing numbers from different scripts is not allowed.</source>
423+
<target>Das Mischen von Zahlen aus verschiedenen Skripten ist nicht erlaubt.</target>
424+
</trans-unit>
425+
<trans-unit id="109">
426+
<source>Using hidden overlay characters is not allowed.</source>
427+
<target>Verstecke Overlay-Zeichen sind nicht erlaubt.</target>
428+
</trans-unit>
409429
</body>
410430
</file>
411431
</xliff>

src/Symfony/Component/VarExporter/Internal/LazyObjectRegistry.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public static function getScope($propertyScopes, $class, $property, $readonlySco
137137
if (\ReflectionProperty::class === $scope = $frame['class'] ?? \Closure::class) {
138138
$scope = $frame['object']->class;
139139
}
140-
if (null === $readonlyScope && '*' === $k[1] && ($class === $scope || is_subclass_of($class, $scope))) {
140+
if (null === $readonlyScope && '*' === $k[1] && ($class === $scope || (is_subclass_of($class, $scope) && !isset($propertyScopes["\0$scope\0$property"])))) {
141141
return null;
142142
}
143143

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
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\Component\VarExporter\Tests\Fixtures\LazyProxy;
13+
14+
class TestOverwritePropClass extends FinalPublicClass
15+
{
16+
public function __construct(
17+
protected string $dep,
18+
protected int $count,
19+
) {
20+
}
21+
22+
public function getDep(): string
23+
{
24+
return $this->dep;
25+
}
26+
}

src/Symfony/Component/VarExporter/Tests/LazyProxyTraitTest.php

+9
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
use Symfony\Component\VarExporter\Tests\Fixtures\LazyProxy\ReadOnlyClass;
2020
use Symfony\Component\VarExporter\Tests\Fixtures\LazyProxy\StringMagicGetClass;
2121
use Symfony\Component\VarExporter\Tests\Fixtures\LazyProxy\TestClass;
22+
use Symfony\Component\VarExporter\Tests\Fixtures\LazyProxy\TestOverwritePropClass;
2223
use Symfony\Component\VarExporter\Tests\Fixtures\LazyProxy\TestUnserializeClass;
2324
use Symfony\Component\VarExporter\Tests\Fixtures\LazyProxy\TestWakeupClass;
2425

@@ -190,6 +191,14 @@ public function testFinalPublicClass()
190191
$this->assertSame(1, $proxy->decrement());
191192
}
192193

194+
public function testOverwritePropClass()
195+
{
196+
$proxy = $this->createLazyProxy(TestOverwritePropClass::class, fn () => new TestOverwritePropClass('123', 5));
197+
198+
$this->assertSame('123', $proxy->getDep());
199+
$this->assertSame(1, $proxy->increment());
200+
}
201+
193202
public function testWither()
194203
{
195204
$obj = new class() {

0 commit comments

Comments
 (0)