Skip to content

Commit 749ef2f

Browse files
committed
Merge branch '2.3' into 2.6
* 2.3: Fix typo Check instance of FormBuilderInterface instead of FormBuilder [Security] TokenBasedRememberMeServices test to show why encoding username is required [Security] AbstractRememberMeServices::encodeCookie() validates cookie parts [console][formater] allow format toString object. [HttpFoundation] Fix baseUrl when script filename is contained in pathInfo Avoid redirection to XHR URIs [HttpFoundation] IpUtils::checkIp4() should allow networks Fix HTML escaping of to-source links [FrameworkBundle] Removed unnecessary parameter in TemplateController [DomCrawler] Throw an exception if a form field path is incomplete. [Console] Delete duplicate test in CommandTest [TwigBundle] Refresh twig paths when resources change. WebProfiler break words fixed typo Update README.md [HttpKernel] Handle an array vary header in the http cache store [Security][Translation] fixes #14584 [Framework] added test for Router commands. Handled bearer authorization header in REDIRECT_ form Conflicts: src/Symfony/Component/Debug/ExceptionHandler.php
2 parents 69d4267 + bb35442 commit 749ef2f

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

FormBuilder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function add($child, $type = null, array $options = array())
6262
throw new BadMethodCallException('FormBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.');
6363
}
6464

65-
if ($child instanceof self) {
65+
if ($child instanceof FormBuilderInterface) {
6666
$this->children[$child->getName()] = $child;
6767

6868
// In case an unresolved child with the same name exists
@@ -72,7 +72,7 @@ public function add($child, $type = null, array $options = array())
7272
}
7373

7474
if (!is_string($child) && !is_int($child)) {
75-
throw new UnexpectedTypeException($child, 'string, integer or Symfony\Component\Form\FormBuilder');
75+
throw new UnexpectedTypeException($child, 'string, integer or Symfony\Component\Form\FormBuilderInterface');
7676
}
7777

7878
if (null !== $type && !is_string($type) && !$type instanceof FormTypeInterface) {

Tests/FormBuilderTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111

1212
namespace Symfony\Component\Form\Tests;
1313

14+
use Symfony\Component\Form\ButtonBuilder;
1415
use Symfony\Component\Form\FormBuilder;
16+
use Symfony\Component\Form\SubmitButtonBuilder;
1517

1618
class FormBuilderTest extends \PHPUnit_Framework_TestCase
1719
{
@@ -154,6 +156,12 @@ public function testCreateNoTypeNo()
154156
$this->builder->create('foo');
155157
}
156158

159+
public function testAddButton()
160+
{
161+
$this->builder->add(new ButtonBuilder('reset'));
162+
$this->builder->add(new SubmitButtonBuilder('submit'));
163+
}
164+
157165
public function testGetUnknown()
158166
{
159167
$this->setExpectedException('Symfony\Component\Form\Exception\InvalidArgumentException', 'The child with the name "foo" does not exist.');

0 commit comments

Comments
 (0)