Skip to content

Commit bced7ca

Browse files
committed
Merge branch '2.4'
* 2.4: [Debug] fixed unit tests Avoid notice from being *eaten* by fatal error. Teardown used wrong property Modified guessDefaultEscapingStrategy to not escape txt templates Fix DateType for 32bits computers. Fixed the registration of validation.xml file when the form is disabled fixed lexing expression ending with spaces Fixes #9633, Removed dependency to Symfony\Bundle\FrameworkBundle\Tests\TestCase [Validator] Replaced inexistent interface. [HttpKernel] Fix profiler event-listener usage outside request stack context When getting the session's id, check if the session is not closed Fix undefined offset when formatting namespace suggestions Adjusting CacheClear Warmup method to namespaced kernels
2 parents bcb0378 + 77f7604 commit bced7ca

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

Extension/Core/Type/DateType.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,9 @@ private function listYears(array $years)
279279
$result = array();
280280

281281
foreach ($years as $year) {
282-
$result[$year] = gmmktime(0, 0, 0, 6, 15, $year);
282+
if (false !== $y = gmmktime(0, 0, 0, 6, 15, $year)) {
283+
$result[$year] = $y;
284+
}
283285
}
284286

285287
return $result;

Tests/Extension/Core/Type/DateTypeTest.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -778,4 +778,25 @@ public function testDayErrorsBubbleUp($widget)
778778
$this->assertSame(array(), $form['day']->getErrors());
779779
$this->assertSame(array($error), $form->getErrors());
780780
}
781+
782+
public function testYearsFor32BitsMachines()
783+
{
784+
if (4 !== PHP_INT_SIZE) {
785+
$this->markTestSkipped(
786+
'PHP must be compiled in 32 bit mode to run this test');
787+
}
788+
789+
$form = $this->factory->create('date', null, array(
790+
'years' => range(1900, 2040),
791+
));
792+
793+
$view = $form->createView();
794+
795+
$listChoices = array();
796+
foreach(range(1902, 2037) as $y) {
797+
$listChoices[] = new ChoiceView($y, $y, $y);
798+
}
799+
800+
$this->assertEquals($listChoices, $view['year']->vars['choices']);
801+
}
781802
}

0 commit comments

Comments
 (0)