date_create_from_format enforces 6 digits for 'u' format character
| Bug #50392 | date_create_from_format enforces 6 digits for 'u' format character | ||||
|---|---|---|---|---|---|
| Submitted: | 2009-12-06 10:53 UTC | Modified: | 2010-03-07 14:08 UTC | ||
| From: | grodny at oneclick dot sk | Assigned: | derick (profile) | ||
| Status: | Closed | Package: | Date/time related | ||
| PHP Version: | 5.3.1 | OS: | * | ||
| Private report: | No | CVE-ID: | None | ||
[2009-12-06 10:53 UTC] grodny at oneclick dot sk
Description: ------------ As a result of fixing bug #45554, 'u' format character now requires exactly 6 digits of microsecond part during parsing. Patch fragment: ... if ((f = timelib_get_nr((char **) &ptr, 6)) == TIMELIB_UNSET || ptr - tptr != 6) { ... Is check for exactly 6 digits really necessary, while other format characters are more benevolent about number of digits being parsed? Reproduce code: --------------- date_default_timezone_set('Europe/Bratislava'); var_dump(date_create_from_format('Y-m-d H:i:s.u', '2009-03-01 18:00:00.0')); Expected result: ---------------- object(DateTime)#1 (3) { ["date"]=> string(19) "2009-03-01 18:00:00" ["timezone_type"]=> int(3) ["timezone"]=> string(17) "Europe/Bratislava" } Actual result: -------------- bool(false)
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2009-12-06 12:11 UTC] derick@php.net
[2009-12-15 12:40 UTC] iliaa@php.net
[2010-02-10 14:32 UTC] derick@php.net
[2010-02-10 16:23 UTC] svn@php.net
[2010-03-07 14:08 UTC] derick@php.net
-Status: Assigned +Status: Closed
[2010-03-07 14:08 UTC] derick@php.net