File tree Expand file tree Collapse file tree 2 files changed +39
-0
lines changed
src/Symfony/Bundle/FrameworkBundle
Tests/DependencyInjection Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -446,6 +446,10 @@ private function addWorkflowSection(ArrayNodeDefinition $rootNode)
446446 ->beforeNormalization ()
447447 ->always ()
448448 ->then (function ($ places ) {
449+ if (!\is_array ($ places )) {
450+ throw new InvalidConfigurationException ('The "places" option must be an array in workflow configuration. ' );
451+ }
452+
449453 // It's an indexed array of shape ['place1', 'place2']
450454 if (isset ($ places [0 ]) && \is_string ($ places [0 ])) {
451455 return array_map (function (string $ place ) {
@@ -491,6 +495,10 @@ private function addWorkflowSection(ArrayNodeDefinition $rootNode)
491495 ->beforeNormalization ()
492496 ->always ()
493497 ->then (function ($ transitions ) {
498+ if (!\is_array ($ transitions )) {
499+ throw new InvalidConfigurationException ('The "transitions" option must be an array in workflow configuration. ' );
500+ }
501+
494502 // It's an indexed array, we let the validation occur
495503 if (isset ($ transitions [0 ]) && \is_array ($ transitions [0 ])) {
496504 return $ transitions ;
Original file line number Diff line number Diff line change 1111
1212namespace Symfony \Bundle \FrameworkBundle \Tests \DependencyInjection ;
1313
14+ use Symfony \Component \Config \Definition \Exception \InvalidConfigurationException ;
1415use Symfony \Component \Config \FileLocator ;
1516use Symfony \Component \DependencyInjection \ContainerBuilder ;
1617use Symfony \Component \DependencyInjection \Exception \LogicException ;
@@ -56,6 +57,36 @@ public function testAssetPackageCannotHavePathAndUrl()
5657 });
5758 }
5859
60+ public function testWorkflowValidationPlacesIsArray ()
61+ {
62+ $ this ->expectException (InvalidConfigurationException::class);
63+ $ this ->expectExceptionMessage ('The "places" option must be an array in workflow configuration. ' );
64+ $ this ->createContainerFromClosure (function ($ container ) {
65+ $ container ->loadFromExtension ('framework ' , [
66+ 'workflows ' => [
67+ 'article ' => [
68+ 'places ' => null ,
69+ ],
70+ ],
71+ ]);
72+ });
73+ }
74+
75+ public function testWorkflowValidationTransitonsIsArray ()
76+ {
77+ $ this ->expectException (InvalidConfigurationException::class);
78+ $ this ->expectExceptionMessage ('The "transitions" option must be an array in workflow configuration. ' );
79+ $ this ->createContainerFromClosure (function ($ container ) {
80+ $ container ->loadFromExtension ('framework ' , [
81+ 'workflows ' => [
82+ 'article ' => [
83+ 'transitions ' => null ,
84+ ],
85+ ],
86+ ]);
87+ });
88+ }
89+
5990 public function testWorkflowValidationStateMachine ()
6091 {
6192 $ this ->expectException (InvalidDefinitionException::class);
You can’t perform that action at this time.
0 commit comments