diff --git a/src/Symfony/Component/Form/Extension/Core/Type/DateType.php b/src/Symfony/Component/Form/Extension/Core/Type/DateType.php index 2ac2f0436ed27..3e3f5b185a465 100644 --- a/src/Symfony/Component/Form/Extension/Core/Type/DateType.php +++ b/src/Symfony/Component/Form/Extension/Core/Type/DateType.php @@ -300,7 +300,9 @@ private function listYears(array $years) $result = array(); foreach ($years as $year) { - $result[$year] = gmmktime(0, 0, 0, 6, 15, $year); + if (false !== $y = gmmktime(0, 0, 0, 6, 15, $year)) { + $result[$year] = $y; + } } return $result; diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php index 7c71b1a033a6f..8674216fa2f4c 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php @@ -774,4 +774,25 @@ public function testDayErrorsBubbleUp($widget) $this->assertSame(array(), $form['day']->getErrors()); $this->assertSame(array($error), $form->getErrors()); } + + public function testYearsFor32BitsMachines() + { + if (4 !== PHP_INT_SIZE) { + $this->markTestSkipped( + 'PHP must be compiled in 32 bit mode to run this test'); + } + + $form = $this->factory->create('date', null, array( + 'years' => range(1900, 2040), + )); + + $view = $form->createView(); + + $listChoices = array(); + foreach(range(1902, 2037) as $y) { + $listChoices[] = new ChoiceView($y, $y, $y); + } + + $this->assertEquals($listChoices, $view['year']->vars['choices']); + } } pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy