Skip to content

Commit bc6536f

Browse files
committed
Merge branch '2.2' into 2.3
* 2.2: 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 When getting the session's id, check if the session is not closed
2 parents 26f1deb + b671293 commit bc6536f

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)