php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #6688 strtotime() function causes loop in do...while condition
Submitted: 2000-09-12 17:40 UTC Modified: 2000-09-17 17:01 UTC
From: simon dot cox at matrixds dot co dot uk Assigned:
Status: Closed Package: Date/time related
PHP Version: 4.0.2 OS: MS Win98 SE
Private report: No CVE-ID: None
 [2000-09-12 17:40 UTC] simon dot cox at matrixds dot co dot uk
Using the following code with the month of October (any year), generates an endless loop; all other months are fine. 

<?
     $dtDate = ("10/01/00");
     $nMonth = ("10");

     do {
          // Build a calendar table
          $dtDate = (date("m/d/y", (strtotime($dtDate) + 86400)));
     } while (date("m", strtotime($dtDate)) == $nMonth);
 ?>


I am using PHP 4.0.2 and Apache 1.3.12 under MS Windows 98 SE. I have tested this script using Linux, Apache and PHP3 and it executes OK for all months.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-09-17 17:01 UTC] stas@php.net
This seems to be because of daylight saving settings. It is wrong to suppose that day is always 86400 seconds. With DST in effect, day can be a hour shorter or a hour longer when DST is going on or off.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 16:01:28 2024 UTC