From: matt at iws dot co dot nz Operating system: Linux 2.4 PHP version: 5.2.0 PHP Bug Type: Date/time related Bug description: strtotime(), incorrect results
Description: ------------ Asking strtotime() for the date of the first occurrence of a particular day of the week, when that day of the week is also the first day of the month, returns the incorrect day. See examples below. Reproduce code: --------------- echo date('Y-m-d', strtotime('first monday jan 2007')); echo date('Y-m-d', strtotime('first monday feb 2007')); echo date('Y-m-d', strtotime('first thursday feb 2007')); echo date('Y-m-d', strtotime('first thursday jan 2007')); Expected result: ---------------- // First Monday Jan 2007 2007-01-01 // First Monday Feb 2007 2007-02-05 // First Thursday Feb 2007 2007-02-01 // First Thursday Jan 2007 2007-01-04 Actual result: -------------- // First Monday Jan 2007 - incorrect 2007-01-08 // First Monday Feb 2007 - correct 2007-02-05 // First Thursday Feb 2007 - incorrect 2007-02-08 // First Thursday Jan 2007 - correct 2007-01-04 -- Edit bug report at http://bugs.php.net/?id=40003&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=40003&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=40003&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=40003&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=40003&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=40003&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=40003&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=40003&r=needscript Try newer version: http://bugs.php.net/fix.php?id=40003&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=40003&r=support Expected behavior: http://bugs.php.net/fix.php?id=40003&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=40003&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=40003&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=40003&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=40003&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=40003&r=dst IIS Stability: http://bugs.php.net/fix.php?id=40003&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=40003&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=40003&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=40003&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=40003&r=mysqlcfg