From: gron1987 at gmail dot com Operating system: Linux PHP version: 5.4.7 Package: Date/time related Bug Type: Bug Bug description:DateTime::createFromFormat() wrong with reset and D,l
Description: ------------ We found that createFromFormat work incorrect. If we use reset in format ("!") and don't send year then we will receive new date in 1970 year, php don't change day of week ("Wed"), it change day("05"). It work correct in 5.3.8 Maybe you broke this when fix this: https://bugs.php.net/bug.php?id=54851 Test script: --------------- <?php $str = "6:15 pm Wed, Oct 5"; $date = DateTime::createFromFormat("!g:i a D, M d", $str); var_dump($date); Expected result: ---------------- class DateTime#1 (3) { public $date => string(19) "1970-10-05 18:15:00" public $timezone_type => int(3) public $timezone => string(13) "Europe/Berlin" } (php 5.3.8) Actual result: -------------- object(DateTime)#1 (3) { ["date"]=> string(19) "1970-10-07 18:15:00" ["timezone_type"]=> int(3) ["timezone"]=> string(15) "Europe/Helsinki" } -- Edit bug report at https://bugs.php.net/bug.php?id=63222&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=63222&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=63222&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=63222&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=63222&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=63222&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=63222&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=63222&r=needscript Try newer version: https://bugs.php.net/fix.php?id=63222&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=63222&r=support Expected behavior: https://bugs.php.net/fix.php?id=63222&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=63222&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=63222&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=63222&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63222&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=63222&r=dst IIS Stability: https://bugs.php.net/fix.php?id=63222&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=63222&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=63222&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=63222&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=63222&r=mysqlcfg