#43208 [Opn->Bgs]: Calculation not taking place
| From: | derick@php.net | Date: | Sun, 11 Nov 2007 14:54:03 +0000 |
| Subject: | #43208 [Opn->Bgs]: Calculation not taking place | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-119445@lists.php.net to get a copy of this message | ||
ID: 43208
Updated by: derick@php.net
Reported By: joel at digitalparadise dot net
-Status: Open
+Status: Bogus
-Bug Type: Reproducible crash
+Bug Type: Date/time related
Operating System: Windows 2000 Server
PHP Version: 5.2.4
New Comment:
We are happy to tell you that you just discovered Daylight Savings
Time. For more information see:
http://webexhibits.org/daylightsaving/b.html
Instead of using mktime/date consider using gmmktime and gmdate which
do
not suffer from DST.
.
Previous Comments:
------------------------------------------------------------------------
[2007-11-06 19:09:10] joel at digitalparadise dot net
Description:
------------
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.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=43208&edit=1