From: jorge at newsengin dot com Operating system: OS X Panther PHP version: 5.0.1 PHP Bug Type: Date/time related Bug description: strtotime does not use second param
Description: ------------ This seems related to the open bug involving "now" resetting to midnight of the current day, but it's not identical. If you try to adjust a time by passing strtotime() an offset like "+2 hours", you get that offset relative to midnight. In other words, strtotime("+2 hours", $unixtimestamp) returns a timestamp for 2 a.m, of the day referenced by $unixtimestamp, or of the current day if the second argument is omitted. Reproduce code: --------------- // in PHP 4, this correctly returns 3:30 p.m. on Jan 1, 2005 but in PHP 5.0.1 returns 2:00 a.m. on Jan 1, 2005: $timeStamp = strtotime("+2 hours", strtotime("1/1/2005 1:30pm")); echo date("r", $timeStamp); // in PHP 4, this correctly returns a date/time for two hours from now, but in PHP 5.0.1 it returns 2 a.m. on the current day: $timeStamp = strtotime("+2 hours"); echo date("r", $timeStamp); Expected result: ---------------- two hours from given date and time or from now, depending on whether a second timestamp argument was provided to strtotime(); Actual result: -------------- 2 a.m. on relevant date. -- Edit bug report at http://bugs.php.net/?id=30042&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30042&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30042&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30042&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=30042&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=30042&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=30042&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=30042&r=needscript Try newer version: http://bugs.php.net/fix.php?id=30042&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=30042&r=support Expected behavior: http://bugs.php.net/fix.php?id=30042&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=30042&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=30042&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=30042&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30042&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=30042&r=dst IIS Stability: http://bugs.php.net/fix.php?id=30042&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=30042&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=30042&r=float MySQL Configuration Error: http://bugs.php.net/fix.php?id=30042&r=mysqlcfg