Closed
Description
Symfony version(s) affected: 3.4
Description
If one (or both) fields in RepeatedType is not mapped the form allows to have different values
How to reproduce
Add to Tests/Extension/Core/Type/RepeatedTypeTest.php
public function testSubmitUnequalNotMapped(): void
{
$input = ['first' => 'foo', 'second' => 'bar'];
$form = $this->factory->create(static::TESTED_TYPE, null, [
'type' => TextTypeTest::TESTED_TYPE,
'first_options' => ['mapped' => false],
'second_options' => ['mapped' => false],
]);
$form->submit($input);
$this->assertSame('foo', $form['first']->getViewData());
$this->assertSame('bar', $form['second']->getViewData());
$this->assertFalse($form->isSynchronized());
$this->assertSame($input, $form->getViewData());
$this->assertNull($form->getData());
}
Happens because \Symfony\Component\Form\Extension\Core\DataTransformer\ValueToDuplicatesTransformer
is called with value === null
on unmapped field.