diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php index e9b95db35a0c2..156c16b27ae8f 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php @@ -446,6 +446,10 @@ private function addWorkflowSection(ArrayNodeDefinition $rootNode) ->beforeNormalization() ->always() ->then(function ($places) { + if (!\is_array($places)) { + throw new InvalidConfigurationException('The "places" option must be an array in workflow configuration.'); + } + // It's an indexed array of shape ['place1', 'place2'] if (isset($places[0]) && \is_string($places[0])) { return array_map(function (string $place) { @@ -491,6 +495,10 @@ private function addWorkflowSection(ArrayNodeDefinition $rootNode) ->beforeNormalization() ->always() ->then(function ($transitions) { + if (!\is_array($transitions)) { + throw new InvalidConfigurationException('The "transitions" option must be an array in workflow configuration.'); + } + // It's an indexed array, we let the validation occur if (isset($transitions[0]) && \is_array($transitions[0])) { return $transitions; diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/PhpFrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/PhpFrameworkExtensionTest.php index 871b62e8811da..77332f5a6b95c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/PhpFrameworkExtensionTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/PhpFrameworkExtensionTest.php @@ -11,6 +11,7 @@ namespace Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection; +use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException; use Symfony\Component\Config\FileLocator; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Exception\LogicException; @@ -56,6 +57,36 @@ public function testAssetPackageCannotHavePathAndUrl() }); } + public function testWorkflowValidationPlacesIsArray() + { + $this->expectException(InvalidConfigurationException::class); + $this->expectExceptionMessage('The "places" option must be an array in workflow configuration.'); + $this->createContainerFromClosure(function ($container) { + $container->loadFromExtension('framework', [ + 'workflows' => [ + 'article' => [ + 'places' => null, + ], + ], + ]); + }); + } + + public function testWorkflowValidationTransitonsIsArray() + { + $this->expectException(InvalidConfigurationException::class); + $this->expectExceptionMessage('The "transitions" option must be an array in workflow configuration.'); + $this->createContainerFromClosure(function ($container) { + $container->loadFromExtension('framework', [ + 'workflows' => [ + 'article' => [ + 'transitions' => null, + ], + ], + ]); + }); + } + public function testWorkflowValidationStateMachine() { $this->expectException(InvalidDefinitionException::class);
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: