File tree 2 files changed +8
-1
lines changed
src/Symfony/Component/Form/Extension/Core
2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,11 @@ class FixUrlProtocolListener implements EventSubscriberInterface
24
24
{
25
25
private $ defaultProtocol ;
26
26
27
+ /**
28
+ * Constructor.
29
+ *
30
+ * @param string|null $defaultProtocol The URL scheme to add when there is none or null to not modify the data
31
+ */
27
32
public function __construct ($ defaultProtocol = 'http ' )
28
33
{
29
34
$ this ->defaultProtocol = $ defaultProtocol ;
Original file line number Diff line number Diff line change @@ -23,7 +23,9 @@ class UrlType extends AbstractType
23
23
*/
24
24
public function buildForm (FormBuilderInterface $ builder , array $ options )
25
25
{
26
- $ builder ->addEventSubscriber (new FixUrlProtocolListener ($ options ['default_protocol ' ]));
26
+ if (null !== $ options ['default_protocol ' ]) {
27
+ $ builder ->addEventSubscriber (new FixUrlProtocolListener ($ options ['default_protocol ' ]));
28
+ }
27
29
}
28
30
29
31
/**
You can’t perform that action at this time.
0 commit comments