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)
504
504
$ normalizer = $ this ->normalizers [$ option ];
505
505
506
506
$ 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 );
508
508
unset($ this ->lock [$ option ]);
509
509
510
510
// The option is now normalized
Original file line number Diff line number Diff line change @@ -514,4 +514,15 @@ public function testClearOptionAndNormalizer()
514
514
$ this ->options ->clear ();
515
515
$ this ->assertEmpty ($ this ->options ->all ());
516
516
}
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
+ }
517
528
}
You can’t perform that action at this time.
0 commit comments