-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Closed
Description
| Q | A |
|---|---|
| Bug report? | yes |
| Feature request? | no |
| BC Break report? | no |
| RFC? | no |
| Symfony version | v3.4.4 |
With this php sample:
declare(strict_types=1);
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormFactory;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormRegistry;
use Symfony\Component\Form\ResolvedFormTypeFactory;
require_once __DIR__.'/vendor/autoload.php';
class ThingType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('name', null, [
'empty_data' => '',
])
->add('closure', null, [
'empty_data' => function (FormInterface $form) {
return '';
},
])
;
}
}
$formFactory = new FormFactory(new FormRegistry([], new ResolvedFormTypeFactory()));
$form = $formFactory->create(ThingType::class);
$form->submit([]);
dump($form->getData());You have:
sullivan@c8dc0d9ca068:/code$ php test.php
array:2 [
"name" => ""
"closure" => null
]
Both should be empty strings.