From: carlos dot jimene dot guirao at gmail dot com Operating system: Ubuntu 10.04.4 LTS PHP version: 5.3.20 Package: Date/time related Bug Type: Bug Bug description:DateTime->modify(last day of ) not working properly for December
Description: ------------ Working with DateTime object as shown on manual. If you modify a DateTime object using this relative format "last day of December Year" it fails giving instead last day of next January. It seems that it was corrected when used in DateTime Constructor instead. So if you create DateTime object using same string in constructor it works. Test script: --------------- $datetime = new DateTime(); $datetime->modify('last day of December 2012'); var_dump($datetime->format('Y-m-d')); $anotherdt = new DateTime('last day of December 2012'); var_dump($anotherdt->format('Y-m-d')); Expected result: ---------------- string(10) "2012-12-31" string(10) "2012-12-31" Actual result: -------------- string(10) "2013-01-31" string(10) "2012-12-31" -- Edit bug report at https://bugs.php.net/bug.php?id=63940&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=63940&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=63940&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=63940&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=63940&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=63940&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=63940&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=63940&r=needscript Try newer version: https://bugs.php.net/fix.php?id=63940&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=63940&r=support Expected behavior: https://bugs.php.net/fix.php?id=63940&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=63940&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=63940&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=63940&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63940&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=63940&r=dst IIS Stability: https://bugs.php.net/fix.php?id=63940&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=63940&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=63940&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=63940&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=63940&r=mysqlcfg