ID: 36638 Updated by: [EMAIL PROTECTED] Reported By: mikeb at tracersinfo dot com -Status: Assigned +Status: Closed Bug Type: Date/time related Operating System: Win32 (XP2) and Linux PHP Version: 5.1.2 Assigned To: derick New Comment:
This bug has been fixed in CVS. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. Fixed in CVS, the fix will be in the upcoming 5.1.3. Previous Comments: ------------------------------------------------------------------------ [2006-03-06 22:29:45] [EMAIL PROTECTED] I'll have a look at it. ------------------------------------------------------------------------ [2006-03-06 22:27:53] mikeb at tracersinfo dot com Description: ------------ Despite recent modifications to the date functions that now allow negative timestamps in both of my environments (Win32 and Linux) [THANK YOU, btw!], strtotime() returns false any time the "now" parameter evaluates to 0 or less, even when it clearly demonstrates it can perform the calculation requested and the date/time in question is within reasonable bounds. Reproduce code: --------------- <?php $a["mktime(1, 2, 3, 4, 5, 1967)"] = mktime(1, 2, 3, 4, 5, 1967); $a["strtotime('-10 years', 0)"] = strtotime('-10 years', 0); $a["strtotime('-10 years', 1)"] = strtotime('-10 years', 1); $a["strtotime('+10 years', 0)"] = strtotime('+10 years', 0); $a["strtotime('+10 years', 1)"] = strtotime('+10 years', 1); $a["gmmktime(0, 0, 0, 1, 1, 1970)"] = gmmktime(0, 0, 0, 1, 1, 1970); $a["strtotime('-10 years', gmmktime(0, 0, 0, 1, 1, 1970))"] = strtotime('-10 years', gmmktime(0, 0, 0, 1, 1, 1970)); $a["strtotime('12/31/1969 19:00:00 -10 years')"] = strtotime('12/31/1969 19:00:00 -10 years'); $a["strtotime('+10 years', gmmktime(0, 0, 0, 1, 1, 1965))"] = strtotime('+10 years', gmmktime(0, 0, 0, 1, 1, 1965)); $a["strtotime('12/31/1964 19:00:00 +10 years')"] = strtotime('12/31/1964 19:00:00 +10 years'); var_dump($a); ?> Expected result: ---------------- array(10) { ["mktime(1, 2, 3, 4, 5, 1967)"]=> int(-86551077) ["strtotime('-10 years', 0)"]=> int(-315619200) <------ ["strtotime('-10 years', 1)"]=> int(-315619199) ["strtotime('+10 years', 0)"]=> int(315532800) <------- ["strtotime('+10 years', 1)"]=> int(315532801) ["gmmktime(0, 0, 0, 1, 1, 1970)"]=> int(0) ["strtotime('-10 years', gmmktime(0, 0, 0, 1, 1, 1970))"]=> int(-315619200) <------ ["strtotime('12/31/1969 19:00:00 -10 years')"]=> int(-315619200) ["strtotime('+10 years', gmmktime(0, 0, 0, 1, 1, 1965))"]=> int(157766400) <------ ["strtotime('12/31/1964 19:00:00 +10 years')"]=> int(157766400) } Actual result: -------------- array(10) { ["mktime(1, 2, 3, 4, 5, 1967)"]=> int(-86551077) ["strtotime('-10 years', 0)"]=> bool(false) <------ ["strtotime('-10 years', 1)"]=> int(-315619199) ["strtotime('+10 years', 0)"]=> bool(false) <------ ["strtotime('+10 years', 1)"]=> int(315532801) ["gmmktime(0, 0, 0, 1, 1, 1970)"]=> int(0) ["strtotime('-10 years', gmmktime(0, 0, 0, 1, 1, 1970))"]=> bool(false) <------ ["strtotime('12/31/1969 19:00:00 -10 years')"]=> int(-315619200) ["strtotime('+10 years', gmmktime(0, 0, 0, 1, 1, 1965))"]=> bool(false) <------ ["strtotime('12/31/1964 19:00:00 +10 years')"]=> int(157766400) } ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=36638&edit=1
