Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 60a14f6

Browse files
committed
Merge branch '2.2' into 2.3
* 2.2: [DoctrineBridge] Added type check to prevent calling clear() on arrays [Intl] Improved FormTypeCsrfExtension to use the type class as default intention if the form name is empty Fix docblock typo Conflicts: src/Symfony/Component/Form/Extension/Csrf/Type/FormTypeCsrfExtension.php
2 parents 14a904d + 2a637b1 commit 60a14f6

File tree

3 files changed

+34
-2
lines changed

3 files changed

+34
-2
lines changed

src/Symfony/Bridge/Doctrine/Form/EventListener/MergeDoctrineCollectionListener.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Bridge\Doctrine\Form\EventListener;
1313

14+
use Doctrine\Common\Collections\Collection;
1415
use Symfony\Component\Form\FormEvents;
1516
use Symfony\Component\Form\FormEvent;
1617
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
@@ -40,7 +41,7 @@ public function onBind(FormEvent $event)
4041

4142
// If all items were removed, call clear which has a higher
4243
// performance on persistent collections
43-
if ($collection && count($data) === 0) {
44+
if ($collection instanceof Collection && count($data) === 0) {
4445
$collection->clear();
4546
}
4647
}

src/Symfony/Component/Form/Tests/Extension/Csrf/Type/FormTypeCsrfExtensionTest.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,37 @@ public function testValidateTokenOnSubmitIfRootAndCompoundUsesTypeClassAsIntenti
278278
$this->assertSame($valid, $form->isValid());
279279
}
280280

281+
/**
282+
* @dataProvider provideBoolean
283+
*/
284+
public function testValidateTokenOnBindIfRootAndCompoundUsesTypeClassAsIntentionIfEmptyFormName($valid)
285+
{
286+
$this->csrfProvider->expects($this->once())
287+
->method('isCsrfTokenValid')
288+
->with('Symfony\Component\Form\Extension\Core\Type\FormType', 'token')
289+
->will($this->returnValue($valid));
290+
291+
$form = $this->factory
292+
->createNamedBuilder('', 'form', null, array(
293+
'csrf_field_name' => 'csrf',
294+
'csrf_provider' => $this->csrfProvider,
295+
'compound' => true,
296+
))
297+
->add('child', 'text')
298+
->getForm();
299+
300+
$form->bind(array(
301+
'child' => 'foobar',
302+
'csrf' => 'token',
303+
));
304+
305+
// Remove token from data
306+
$this->assertSame(array('child' => 'foobar'), $form->getData());
307+
308+
// Validate accordingly
309+
$this->assertSame($valid, $form->isValid());
310+
}
311+
281312
public function testFailIfRootAndCompoundAndTokenMissing()
282313
{
283314
$this->csrfProvider->expects($this->never())

src/Symfony/Component/Security/Http/RememberMe/AbstractRememberMeServices.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ protected function cancelCookie(Request $request)
291291
}
292292

293293
/**
294-
* Checks whether remember-me capabilities where requested
294+
* Checks whether remember-me capabilities were requested
295295
*
296296
* @param Request $request
297297
*

0 commit comments

Comments
 (0)