Skip to content

Commit d7b7f27

Browse files
committed
bug #9416 fixed issue with clone now the children of the original form are preserved and the clone form is given new children (yjv)
This PR was merged into the 2.3 branch. Discussion ---------- fixed issue with clone now the children of the original form are preserved and the clone form is given new children | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | 9414 | License | MIT | Doc PR | this commit fixes #9414 Commits ------- b952bcb fixed issue with clone now the children of the original form are preserved and the clone form is given new children
2 parents bafa012 + a139b2a commit d7b7f27

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

Form.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,8 @@ public function __construct(FormConfigInterface $config)
170170

171171
public function __clone()
172172
{
173+
$this->children = clone $this->children;
174+
173175
foreach ($this->children as $key => $child) {
174176
$this->children[$key] = clone $child;
175177
}

Tests/CompoundFormTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ public function testCloneChildren()
141141

142142
$this->assertNotSame($this->form, $clone);
143143
$this->assertNotSame($child, $clone['child']);
144+
$this->assertNotSame($this->form['child'], $clone['child']);
144145
}
145146

146147
public function testNotEmptyIfChildNotEmpty()

0 commit comments

Comments
 (0)