ID: 39311 Updated by: [EMAIL PROTECTED] Reported By: xg_wahyu at yahoo dot com -Status: Open +Status: Bogus Bug Type: Date/time related Operating System: Windows XP PHP Version: 5.1.6 New Comment:
We are happy to tell you that you just discovered Daylight Savings Time. For more information see: http://webexhibits.org/daylightsaving/b.html Instead of using mktime/date consider using gmmktime and gmdate which do not suffer from DST. Your code is broken, not all days have 86400 seconds... (when DST changes f.e.) Previous Comments: ------------------------------------------------------------------------ [2006-10-30 16:42:19] xg_wahyu at yahoo dot com Description: ------------ I run such script on my webserver Apache 2.0 running PHP 5.1.6 Before the date 28 October 2006 inclusive, everything works fine. On the 29 October, the result does not yield string "29 October 2006" and after 29 October 2006 the script simply crashes the server (the task manager indicates 50% CPU time on apache.exe from my pentium 4 HT processor for 30 seconds before timeout) Halloween Egg? (not easter egg)? Reproduce code: --------------- $now = mktime(0,0,0,date('m'),date('d'),date('Y')); $first = mktime(0,0,0,10,1,2006); $diff = ($now - $first)/86400 + 1; for ($i=$diff;$i>0;$i--) { $a = strtotime("-$i day"); $today = getdate("$a"); $month_format = $today['mon']; $day_format = $today['mday']; $year_format = $today['year']; echo "$month_format/$day_format/$year_format<br />"; } Expected result: ---------------- Anything ranging from the date 9/30/2006 up to the current date set on the server clock Actual result: -------------- //date:27 october 2006 (correct) ... 10/25/2006 10/26/2006 10/27/2006 //date:28 october 2006 (correct) ... 10/25/2006 10/26/2006 10/27/2006 10/28/2006 //date:29 october 2006 (simply '10/29/2006' missing) ... 10/25/2006 10/26/2006 10/27/2006 10/28/2006 //date:30 october 2006 and so on (simply crashes the system and returns... "Fatal error: Maximum execution time of 30 seconds exceeded in D:\php\toko\ntz.php on line 15") ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=39311&edit=1