Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Extra fieldsets are created when calling form bind multiple times #6118

merged 2 commits into from

3 participants

Stanislav Marco Pivetta Matthew Weier O'Phinney

Yet another test to demonstrate regression since #5636

Ref to #6074 #6100
Removing changes in #5093 fixes this

Stanislav thestanislav changed the title from Extra fieldsets are created when calling form multiple two times to Extra fieldsets are created when calling form bind multiple times
Marco Pivetta Ocramius added Form bug labels
Matthew Weier O'Phinney weierophinney merged commit 66fa34e into from
Matthew Weier O'Phinney weierophinney referenced this pull request from a commit
Matthew Weier O'Phinney weierophinney Merge branch 'hotfix/6118'
Close #6118
Matthew Weier O'Phinney weierophinney added this to the 2.3.1 milestone
Matthew Weier O'Phinney weierophinney self-assigned this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 9, 2014
  1. Stanislav

    Collection fieldsets are dublicated when calling form bind two times,…

    thestanislav authored
    … one more test to demonstrate regression since #5636
  2. Stanislav

    Change func. name

    thestanislav authored
This page is out of date. Refresh to see the latest.
Showing with 24 additions and 0 deletions.
  1. +24 −0 tests/ZendTest/Form/Element/CollectionTest.php
24 tests/ZendTest/Form/Element/CollectionTest.php
@@ -422,6 +422,30 @@ public function testCreatesNewObjectsIfSpecified()
$this->assertNotSame($categories[1], $cat2);
+ public function testDoNotCreateExtraFieldsetOnMultipleBind()
+ {
+ $form = new \Zend\Form\Form();
+ $this->productFieldset->setHydrator(new \Zend\Stdlib\Hydrator\ClassMethods());
+ $form->add($this->productFieldset);
+ $form->setHydrator(new \Zend\Stdlib\Hydrator\ObjectProperty());
+ $product = new Product();
+ $categories = array(new \ZendTest\Form\TestAsset\Entity\Category(), new \ZendTest\Form\TestAsset\Entity\Category());
+ $product->setCategories($categories);
+ $market = new \StdClass();
+ $market->product = $product;
+ // this will pass the test
+ $form->bind($market);
+ $this->assertSame(count($categories), iterator_count($form->get('product')->get('categories')->getIterator()));
+ // this won't pass, but must
+ $form->bind($market);
+ $this->assertSame(count($categories), iterator_count($form->get('product')->get('categories')->getIterator()));
+ }
public function testExtractDefaultIsEmptyArray()
$collection = $this->form->get('fieldsets');
Something went wrong with that request. Please try again.