8000 [Form] Fix #11694 - Enforce options value type check in some form types by kix · Pull Request #11696 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Form] Fix #11694 - Enforce options value type check in some form types #11696

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
[Form] Fix #11694 - Enforce RepeatedType options value type check
  • Loading branch information
kix committed Aug 18, 2014
commit b312a004f3fd14e6e25a64a0d6c8dfacf2dcde99
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ public function setDefaultOptions(OptionsResolverInterface $resolver)
'second_name' => 'second',
'error_bubbling' => false,
));

$resolver->setAllowedTypes(array(
'options' => 'array',
'first_options' => 'array',
'second_options' => 'array',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add it for options too

));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,39 @@ public function testSetRequired()
$this->assertFalse($form['second']->isRequired());
}

/**
* @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
*/
public function testSetInvalidOptions()
{
$this->factory->create('repeated', null, array(
'type' => 'text',
'options' => 'bad value',
));
}

/**
* @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
*/
public function testSetInvalidFirstOptions()
{
$this->factory->create('repeated', null, array(
'type' => 'text',
'first_options' => 'bad value',
));
}

/**
* @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
*/
public function testSetInvalidSecondOptions()
{
$this->factory->create('repeated', null, array(
'type' => 'text',
'second_options' => 'bad value',
));
}

public function testSetErrorBubblingToTrue()
{
$form = $this->factory->create('repeated', null, array(
Expand Down
0