From: lenzai2004-dev at yahoo dot fr Operating system: Ubuntu 11.10 64bits PHP version: 5.3.13 Package: Date/time related Bug Type: Feature/Change Request Bug description:createfromFormat assign current time by default when reading date only string.
Description: ------------ DateTime:createFromFormat() and DateTime::__construct are not consistent for parsing dates. __construct sets default time at 00:00:00 DateTime::createFromFormat() sets default time at current time Test script: --------------- var_export(DateTime::createFromFormat("Y-m-d","2012-05-11")); var_export(new DateTime("2012-05-11")); Expected result: ---------------- DateTime::__set_state(array( 'date' => '2012-05-11 00:00:00', 'timezone_type' => 3, 'timezone' => 'Asia/Chongqing', )) DateTime::__set_state(array( 'date' => '2012-05-11 00:00:00', 'timezone_type' => 3, 'timezone' => 'Asia/Chongqing', )) Actual result: -------------- DateTime::__set_state(array( 'date' => '2012-05-11 18:34:45', 'timezone_type' => 3, 'timezone' => 'Asia/Chongqing', )) DateTime::__set_state(array( 'date' => '2012-05-11 00:00:00', 'timezone_type' => 3, 'timezone' => 'Asia/Chongqing', )) -- Edit bug report at https://bugs.php.net/bug.php?id=62166&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=62166&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=62166&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=62166&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=62166&r=fixed Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=62166&r=needdocs Fixed in release: https://bugs.php.net/fix.php?id=62166&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=62166&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=62166&r=needscript Try newer version: https://bugs.php.net/fix.php?id=62166&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=62166&r=support Expected behavior: https://bugs.php.net/fix.php?id=62166&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=62166&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=62166&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=62166&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=62166&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=62166&r=dst IIS Stability: https://bugs.php.net/fix.php?id=62166&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=62166&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=62166&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=62166&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=62166&r=mysqlcfg