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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: simon dot cox at matrixds dot co dot uk
New email:
PHP Version: OS:

 

 [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

Add a Patch

Pull Requests

Add a Pull Request

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-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC