8000 [Form] Update password type trimming to false · lanthaler/symfony@97f6a1b · GitHub
[go: up one dir, main page]

Skip to content

Commit 97f6a1b

Browse files
committed
[Form] Update password type trimming to false
1 parent 7bfe13c commit 97f6a1b

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

UPGRADE-2.2.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,7 @@
3131
$accepts = AcceptHeader::fromString($request->headers->get('Accept'))->all();
3232
3333
```
34+
35+
### Form
36+
37+
* The PasswordType is now not trimmed by default.

src/Symfony/Component/Form/Extension/Core/Type/PasswordType.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public function setDefaultOptions(OptionsResolverInterface $resolver)
3535
{
3636
$resolver->setDefaults(array(
3737
'always_empty' => true,
38+
'trim' => false,
3839
));
3940
}
4041

src/Symfony/Component/Form/Tests/Extension/Core/Type/PasswordTypeTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,13 @@ public function testNotEmptyIfBoundAndNotAlwaysEmpty()
3939

4040
$this->assertSame('pAs5w0rd', $view->vars['value']);
4141
}
42+
43+
public function testNotTrimmed()
44+
{
45+
$form = $this->factory->create('password', null);
46+
$form->bind(' pAs5w0rd ');
47+
$data = $form->getData();
48+
49+
$this->assertSame(' pAs5w0rd ', $data);
50+
}
4251
}

0 commit comments

Comments
 (0)
0