From: scottmacvicar at ntlworld dot com Operating system: * PHP version: 4CVS-2004-03-08 (stable) PHP Bug Type: Date/time related Bug description: gmmktime can return wrong value on the night that DST comes into affect
Description: ------------ This bug seems to have different affect on Windows and Linux. Windows ------ System has to be running GMT and Automatically adjust clock for daylight savings time checked. You'll notice that the 27th appears twice. The second occurence of the 27th is Sat Mar 27 23:00:00 2004. ------ Redhat 9.0 ------ The timestamp for linux on the 28th is Sun Mar 28 02:00:00 2004 /etc/sysconfig/clock ZONE="Europe/London" UTC=true ARC=false ------ So Windows lost an hour and linux gained 2 hours. Patch --- datetime.c 2004-03-09 02:19:32.000000000 +0000 +++ datetime.c.patched 2004-03-09 02:20:48.000000000 +0000 @@ -192,8 +192,8 @@ /* fall-through */ case 1: /* hour */ val = (*arguments[0])->value.lval; - if (val < 1) { - chgsecs += (1-val) * 60*60; val = 1; + if (val < 2) { + chgsecs += (2-val) * 60*60; val = 2; } ta->tm_hour = val; /* fall-through */ Changing the time to 02:01:01 seems to correct this issue and the windows machine stops eating an hour and not setting tm_idst to 1 and i have no idea whats going on with the linux machine. Reproduce code: --------------- <?php for ($i = 26; $i <= 29; $i++) { $datestamp = gmmktime(0, 0, 0, 3, $i, 2004); $day = gmdate('j', $datestamp); echo "$datestamp - $day\n\n"; } ?> Expected result: ---------------- 1080259200 - 26 1080345600 - 27 1080432000 - 28 1080518400 - 29 Actual result: -------------- Windows --- 1080259200 - 26 1080345600 - 27 1080428400 - 27 1080518400 - 29 Linux --- 1080259200 - 26 1080345600 - 27 1080439200 - 28 1080518400 - 29 -- Edit bug report at http://bugs.php.net/?id=27533&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=27533&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=27533&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=27533&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=27533&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=27533&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=27533&r=needscript Try newer version: http://bugs.php.net/fix.php?id=27533&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=27533&r=support Expected behavior: http://bugs.php.net/fix.php?id=27533&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=27533&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=27533&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=27533&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27533&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=27533&r=dst IIS Stability: http://bugs.php.net/fix.php?id=27533&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=27533&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=27533&r=float