From: grodny at oneclick dot sk
Operating system:
PHP version: 5.3.1
PHP Bug Type: Date/time related
Bug description: date_create_from_format enforces 6 digits for 'u' format
character
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 bug report at http://bugs.php.net/?id=50392&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=50392&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=50392&r=trysnapshot53
Try a snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=50392&r=trysnapshot60
Fixed in SVN:
http://bugs.php.net/fix.php?id=50392&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=50392&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=50392&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=50392&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=50392&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=50392&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=50392&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=50392&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=50392&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=50392&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=50392&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50392&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=50392&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=50392&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=50392&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=50392&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=50392&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=50392&r=mysqlcfg