|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43208 Calculation not taking place
Submitted: 2007-11-06 19:09 UTC Modified: 2007-11-11 14:54 UTC
Avg. Score:1.0 ± 0.0
Reproduced:0 of 1 (0.0%)
From: joel at digitalparadise dot net Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 5.2.4 OS: Windows 2000 Server
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.
Block user comment
Status: Assign to:
Bug Type:
From: joel at digitalparadise dot net
New email:
PHP Version: OS:


 [2007-11-06 19:09 UTC] joel at digitalparadise dot net
This code is part of a larger while loop which stops when "$dayloop == false".

This page is a report of employee clock-in and clock-out times.  It shows the employee, followed by each day that the report includes, and their times.

This code works in some circumstances, but most of the time, the 3rd line simply does not execute, or rather the value is never updated - thus resulting in an endless loop (because $dayloop stays true).

It used to work perfectly (for over 6 months...) on several versions of PHP, so I do not believe this to be something version-related.

Reproduce code:
At this point, $thisday would be a date in the format "YYYY-mm-dd".

$timestamp = strtotime($thisday);
$timestamp = $timestamp + (60 * 60 * 24);  <-- this line does not work
if ($timestamp > strtotime($enddate)) {
   $dayloop = false;
$thisday = date("Y-m-d", $timestamp);      <-- creates the above value

Expected result:
$timestamp = $timestamp + (60 * 60 * 24) 

I expect the value of $timestamp to increase by 86400.

Actual result:
Sometimes the code works for a few cycles, but eventually it will stop incrementing the value of $timestamp and the script will time out.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-11-11 14:54 UTC]
We are happy to tell you that you just discovered Daylight Savings
Time. For more information see:
Instead of using mktime/date consider using gmmktime and gmdate which do
not suffer from DST.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Jun 13 09:01:34 2024 UTC