#40917 [NEW]: strtotime() will not generate a timestamp close to 20061029 (BST)

From: Date: Mon, 26 Mar 2007 09:23:40 +0000
Subject: #40917 [NEW]: strtotime() will not generate a timestamp close to 20061029 (BST)
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-110776@lists.php.net to get a copy of this message
From: team at iris dot ac Operating system: GNU/Linux PHP version: 5.2.1 PHP Bug Type: Date/time related Bug description: strtotime() will not generate a timestamp close to 20061029 (BST) Description: ------------ Whilst looping with strtotime(), manually incrementing the day by 1 on each iteration we are hitting an infinite loop where the date never goes beyond 20061029. This has been happening since the shift to DST yesterday. Take the following two demonstrations: <?php /** This works perfectly fine **/ $t = strtotime('20060901'); while ($t < strtotime('20070720')) { $t += 86400; echo date("Ymd", $t) . "<br />"; } ?> and... <?php /** This hangs at 20061029 **/ $t = date('Ymd', strtotime('20060901')); while ($t < date('Ymd', strtotime('20070720'))) { $t = date('Ymd', strtotime($t)+86400); echo $t . "<br />"; } ?> They should both logically do the same thing, and until we ran the code today they did do, but since the DST shift we see this hang at 20061029. We've tested this on 5.1.6 and 5.2.1 with the same results. It seems to work ok on 5.2.0. We are in the Europe/London timezone (BST). Reproduce code: --------------- <?php /** This works perfectly fine **/ $t = strtotime('20060901'); while ($t < strtotime('20070720')) { $t += 86400; echo date("Ymd", $t) . "<br />"; } ?> and... <?php /** This hangs at 20061029 **/ $t = date('Ymd', strtotime('20060901')); while ($t < date('Ymd', strtotime('20070720'))) { $t = date('Ymd', strtotime($t)+86400); echo $t . "<br />"; } ?> Expected result: ---------------- We expect the get a list of days between the start and end ranges, instead, we get a list of days up to 20061029, followed by a never ending list of 20061029 repeated whilst it tries to increment further, unsuccessfully. Actual result: -------------- 20060902 20060903 20060904 20060905 20060906 20060907 20060908 20060909 20060910 20060911 20060912 20060913 20060914 20060915 20060916 20060917 20060918 20060919 20060920 20060921 20060922 20060923 20060924 20060925 20060926 20060927 20060928 20060929 20060930 20061001 20061002 20061003 20061004 20061005 20061006 20061007 20061008 20061009 20061010 20061011 20061012 20061013 20061014 20061015 20061016 20061017 20061018 20061019 20061020 20061021 20061022 20061023 20061024 20061025 20061026 20061027 20061028 20061029 20061029 20061029 20061029 20061029 20061029 20061029 20061029 20061029 20061029 20061029 20061029 20061029 20061029 20061029 20061029 20061029 20061029 20061029 20061029 20061029 20061029 20061029 20061029 20061029 20061029 20061029 20061029 20061029 20061029 20061029 20061029 20061029 20061029 20061029 20061029 20061029 20061029 20061029 20061029 20061029 20061029 .. and so on .... -- Edit bug report at http://bugs.php.net/?id=40917&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=40917&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=40917&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=40917&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=40917&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=40917&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=40917&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=40917&r=needscript Try newer version: http://bugs.php.net/fix.php?id=40917&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=40917&r=support Expected behavior: http://bugs.php.net/fix.php?id=40917&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=40917&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=40917&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=40917&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=40917&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=40917&r=dst IIS Stability: http://bugs.php.net/fix.php?id=40917&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=40917&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=40917&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=40917&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=40917&r=mysqlcfg

« previous php.bugs (#110776) next »