#50392 [Asn->Csd]: date_create_from_format enforces 6 digits for 'u' format character
ID: 50392
Updated by: iliaa@php.net
Reported By: grodny at oneclick dot sk
-Status: Assigned
+Status: Closed
Bug Type: Date/time related
Operating System: *
PHP Version: 5.3.1
Assigned To: derick
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2009-12-15 12:34:17] svn@php.net
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] derick@php.net
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
Thread (6 messages)