Skip to content

Commit ce2a25e

Browse files
Merge branch '5.4' into 6.2
* 5.4: [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 f65b0a4 + fdf441d commit ce2a25e

File tree

7 files changed

+75
-11
lines changed

7 files changed

+75
-11
lines changed

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

+8
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,10 @@ private function addWorkflowSection(ArrayNodeDefinition $rootNode)
454454
->beforeNormalization()
455455
->always()
456456
->then(function ($places) {
457+
if (!\is_array($places)) {
458+
throw new InvalidConfigurationException('The "places" option must be an array in workflow configuration.');
459+
}
460+
457461
// It's an indexed array of shape ['place1', 'place2']
458462
if (isset($places[0]) && \is_string($places[0])) {
459463
return array_map(function (string $place) {
@@ -499,6 +503,10 @@ private function addWorkflowSection(ArrayNodeDefinition $rootNode)
499503
->beforeNormalization()
500504
->always()
501505
->then(function ($transitions) {
506+
if (!\is_array($transitions)) {
507+
throw new InvalidConfigurationException('The "transitions" option must be an array in workflow configuration.');
508+
}
509+
502510
// It's an indexed array, we let the validation occur
503511
if (isset($transitions[0]) && \is_array($transitions[0])) {
504512
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
@@ -86,6 +86,7 @@ public function denormalize(mixed $data, string $type, string $format = null, ar
8686
if (AbstractPart::class === $type) {
8787
$type = $data['class'];
8888
unset($data['class']);
89+
$data['headers'] = $this->serializer->denormalize($data['headers'], Headers::class, $format, $context);
8990
}
9091

9192
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>

0 commit comments

Comments
 (0)