This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
symfony/src/Symfony
Fabien Potencier e6e235b6f4 bug #25781 [Form] Disallow transform dates beyond the year 9999 (curry684)
This PR was squashed before being merged into the 2.7 branch (closes #25781).

Discussion
----------

[Form] Disallow transform dates beyond the year 9999

Fixes #14727

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | not really
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #14727
| License       | MIT

Explicitly locked out submission of dates beyond December 31st 9999 in forms as PHP is highly incapable of consistently handling such dates. Before this patch dates were randomly transformed or mangled.

Technically there is a BC break as this will now cause validation to fail on input that was *accepted* before, but it was mangled. Not my call but I prefer the rejection over data corruption:
```
// Old behavior
$transformer = new DateTimeToLocalizedStringTransformer('UTC', 'UTC', null, null, \IntlDateFormatter::GREGORIAN, 'yyyy-MM-dd');
$result = $transformer->reverseTransform('20107-03-21');

// $result is now 2007-03-21
```

Commits
-------

70cc969537 [Form] Disallow transform dates beyond the year 9999
2018-01-17 09:13:32 +01:00
..
Bridge minor #25752 Don't right trim the deprecation message (alexpott) 2018-01-14 15:14:25 +01:00
Bundle Add the missing enabled session attribute 2018-01-10 17:16:33 +00:00
Component bug #25781 [Form] Disallow transform dates beyond the year 9999 (curry684) 2018-01-17 09:13:32 +01:00