ID: 50392 Updated by: [email protected] Reported By: grodny at oneclick dot sk -Status: Closed +Status: Open Bug Type: Date/time related Operating System: * PHP Version: 5.3.1 -Assigned To: +Assigned To: derick New Comment:
Reopening as this bug was fixed incorrectly. It would treat "0010" as "000010" which is not what it is meant to do. The test case didn't properly test the values either. Previous Comments: ------------------------------------------------------------------------ [2009-12-15 12:40:47] [email protected] This bug has been fixed in SVN. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. ------------------------------------------------------------------------ [2009-12-15 12:34:17] [email protected] Automatic comment from SVN on behalf of iliaa Revision: http://svn.php.net/viewvc/?view=revision&revision=292162 Log: Fixed bu #50392 (date_create_from_format() enforces 6 digits for 'u' format character) ------------------------------------------------------------------------ [2009-12-06 12:11:07] [email protected] Hi, I guess it's not really required, I'll have a look (in a bit). Derick ------------------------------------------------------------------------ [2009-12-06 10:53:34] 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) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=50392&edit=1
