Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 6e58155

Browse filesBrowse files
committed
[Form] Fixed empty conversion of Intl types
1 parent ac8fca5 commit 6e58155
Copy full SHA for 6e58155

File tree

7 files changed

+26
-0
lines changed
Filter options

7 files changed

+26
-0
lines changed

‎src/Symfony/Component/Form/Extension/Core/Type/CountryType.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Extension/Core/Type/CountryType.php
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ public function loadChoiceList($value = null)
7575
public function loadChoicesForValues(array $values, $value = null)
7676
{
7777
// Optimize
78+
$values = array_filter($values);
7879
if (empty($values)) {
7980
return array();
8081
}
@@ -93,6 +94,7 @@ public function loadChoicesForValues(array $values, $value = null)
9394
public function loadValuesForChoices(array $choices, $value = null)
9495
{
9596
// Optimize
97+
$choices = array_filter($choices);
9698
if (empty($choices)) {
9799
return array();
98100
}

‎src/Symfony/Component/Form/Extension/Core/Type/CurrencyType.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Extension/Core/Type/CurrencyType.php
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ public function loadChoiceList($value = null)
7474
*/
7575
public function loadChoicesForValues(array $values, $value = null)
7676
{
77+
$values = array_filter($values);
7778
// Optimize
7879
if (empty($values)) {
7980
return array();
@@ -92,6 +93,7 @@ public function loadChoicesForValues(array $values, $value = null)
9293
*/
9394
public function loadValuesForChoices(array $choices, $value = null)
9495
{
96+
$choices = array_filter($choices);
9597
// Optimize
9698
if (empty($choices)) {
9799
return array();

‎src/Symfony/Component/Form/Extension/Core/Type/LanguageType.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Extension/Core/Type/LanguageType.php
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ public function loadChoiceList($value = null)
7474
*/
7575
public function loadChoicesForValues(array $values, $value = null)
7676
{
77+
$values = array_filter($values);
7778
// Optimize
7879
if (empty($values)) {
7980
return array();
@@ -92,6 +93,7 @@ public function loadChoicesForValues(array $values, $value = null)
9293
*/
9394
public function loadValuesForChoices(array $choices, $value = null)
9495
{
96+
$choices = array_filter($choices);
9597
// Optimize
9698
if (empty($choices)) {
9799
return array();

‎src/Symfony/Component/Form/Extension/Core/Type/LocaleType.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Extension/Core/Type/LocaleType.php
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ public function loadChoiceList($value = null)
7474
*/
7575
public function loadChoicesForValues(array $values, $value = null)
7676
{
77+
$values = array_filter($values);
7778
// Optimize
7879
if (empty($values)) {
7980
return array();
@@ -92,6 +93,7 @@ public function loadChoicesForValues(array $values, $value = null)
9293
*/
9394
public function loadValuesForChoices(array $choices, $value = null)
9495
{
96+
$choices = array_filter($choices);
9597
// Optimize
9698
if (empty($choices)) {
9799
return array();

‎src/Symfony/Component/Form/Extension/Core/Type/TimezoneType.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Extension/Core/Type/TimezoneType.php
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ public function loadChoiceList($value = null)
7171
*/
7272
public function loadChoicesForValues(array $values, $value = null)
7373
{
74+
$values = array_filter($values);
7475
// Optimize
7576
if (empty($values)) {
7677
return array();
@@ -89,6 +90,7 @@ public function loadChoicesForValues(array $values, $value = null)
8990
*/
9091
public function loadValuesForChoices(array $choices, $value = null)
9192
{
93+
$choices = array_filter($choices);
9294
// Optimize
9395
if (empty($choices)) {
9496
return array();

‎src/Symfony/Component/Form/Tests/Extension/Core/Type/CurrencyTypeTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Tests/Extension/Core/Type/CurrencyTypeTest.php
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,12 @@ public function testCurrenciesAreSelectable()
3434
$this->assertContains(new ChoiceView('USD', 'USD', 'US Dollar'), $choices, '', false, false);
3535
$this->assertContains(new ChoiceView('SIT', 'SIT', 'Slovenian Tolar'), $choices, '', false, false);
3636
}
37+
38+
public function testSubmitNull()
39+
{
40+
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CurrencyType');
41+
$form->submit(null);
42+
43+
$this->assertNull($form->getData());
44+
}
3745
}

‎src/Symfony/Component/Form/Tests/Extension/Core/Type/TimezoneTypeTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Tests/Extension/Core/Type/TimezoneTypeTest.php
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,12 @@ public function testTimezonesAreSelectable()
2727
$this->assertArrayHasKey('America', $choices);
2828
$this->assertContains(new ChoiceView('America/New_York', 'America/New_York', 'New York'), $choices['America'], '', false, false);
2929
}
30+
31+
public function testSubmitNull()
32+
{
33+
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\TimezoneType');
34+
$form->submit(null);
35+
36+
$this->assertNull($form->getData());
37+
}
3038
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.