File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
src/Symfony/Component/OptionsResolver Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -504,7 +504,7 @@ private function normalize($option)
504504 $ normalizer = $ this ->normalizers [$ option ];
505505
506506 $ this ->lock [$ option ] = true ;
507- $ this ->options [$ option ] = $ normalizer ($ this , $ this ->options [$ option ]);
507+ $ this ->options [$ option ] = $ normalizer ($ this , array_key_exists ( $ option , $ this ->options ) ? $ this -> options [$ option ] : null );
508508 unset($ this ->lock [$ option ]);
509509
510510 // The option is now normalized
Original file line number Diff line number Diff line change @@ -514,4 +514,15 @@ public function testClearOptionAndNormalizer()
514514 $ this ->options ->clear ();
515515 $ this ->assertEmpty ($ this ->options ->all ());
516516 }
517+
518+ public function testNormalizerWithoutCorrespondingOption ()
519+ {
520+ $ test = $ this ;
521+
522+ $ this ->options ->setNormalizer ('foo ' , function (Options $ options , $ previousValue ) use ($ test ) {
523+ $ test ->assertNull ($ previousValue );
524+ return '' ;
525+ });
526+ $ this ->assertEquals (array ('foo ' => '' ), $ this ->options ->all ());
527+ }
517528}
You can’t perform that action at this time.
0 commit comments