I've been banging my head against a wall all day trying to figure this out, and unfortunately I haven't managed to get a nice self contained test case to re-create the problem. But I'm just going to throw the question out there and hope someone has some insight. I know it's a long shot...
I have a form that I am attempting to remove a field from with the Form->remove() method. When I call the method, the fields appear to be removed. But whenever I call the Form->bind() method, the subsequently invoked Form->writeObject() method is still iterating over the removed fields. With debug tools, I have verified *both* of the following are true: 1. The Form->fields array no longer includes the fields removed via Form->remove() 2. The Form->writeObject is iterating over the supposedly removed fields I tried to re-create the problem with the following test, but this test actually passes. So there must be something about my particular environment / context that's causing this. use Symfony\Component\Form\Form; use Symfony\Component\Form\TextField; use Symfony\Component\HttpFoundation\Request; class DataObject { public $one; public $two; } class ExampleForm extends Form { public function configure() { $this->add(new TextField('one')); $this->add(new TextField('two')); parent::configure(); } } class FormFieldTest extends \PHPUnit_Framework_TestCase { public function testRemoveField() { $data = new DataObject(); $data->one = 'something'; $data->two = 'something else'; $form = new ExampleForm('example', array('validator' => $this- >createMockValidator())); $form->remove('two'); $form->bind($this->createPostRequest(), $data); $this->assertNull($data->one); $this->assertEquals('something else', $data->two); } protected function createMockValidator() { return $this->getMock('Symfony\Component\Validator \ValidatorInterface'); } protected function createPostRequest(array $values = array(), array $files = array()) { $server = array('REQUEST_METHOD' => 'POST'); return new Request(array(), $values, array(), array(), $files, $server); } } Does anyone have any clue as to how or why Form->writeObject() would still iterate over field that have been removed? -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en