Skip to content

Commit 37ea807

Browse files
Merge branch '6.3' into 6.4
* 6.3: [Mime] Fix lowest versions of deps [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 [Webhook] Allow slash in webhook type [FrameworkBundle][Workflow] Throw exception is workflow.xxx.transitions is not an array
2 parents 1e43ce2 + 930fe7e commit 37ea807

File tree

3 files changed

+40
-0
lines changed

3 files changed

+40
-0
lines changed

DependencyInjection/Configuration.php

Lines changed: 8 additions & 0 deletions
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;

Resources/config/routing/webhook.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@
66

77
<route id="_webhook_controller" path="/{type}">
88
<default key="_controller">webhook.controller::handle</default>
9+
<requirement key="type">.+</requirement>
910
</route>
1011
</routes>

Tests/DependencyInjection/PhpFrameworkExtensionTest.php

Lines changed: 31 additions & 0 deletions
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;
@@ -60,6 +61,36 @@ public function testAssetPackageCannotHavePathAndUrl()
6061
});
6162
}
6263

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

0 commit comments

Comments
 (0)