Edit report at http://bugs.php.net/bug.php?id=52920&edit=1
ID: 52920
User updated by: michael at nerdalert dot biz
Reported by: michael at nerdalert dot biz
-Summary: Division equations are overridden
+Summary: Multiple datetime affects divisions
Status: Open
Type: Bug
Package: Date/time related
Operating System: Windows Server 2008 R2 Enterpris
PHP Version: 5.3.3
Block user comment: N
New Comment:
Changing the title only
Previous Comments:
------------------------------------------------------------------------
[2010-09-24 17:25:48] michael at nerdalert dot biz
Description:
------------
The result of this equation (echo 240 / 23;) is NAN in each occurrence
when I run DateTime class before the equation. The datetime class needs
to be run multiple times to get the NAN result (for ($a=0;$a<2;$a++){).
Test script:
---------------
for ($a=0;$a<2;$a++){
$lastResponse = date("Y-m-d");
$noResponse = date("Y-m-d");
$dateCreated = new DateTime(date("Y-m-d", strtotime($lastResponse)));
$dateNotCreated = new DateTime(date("Y-m-d", strtotime($noResponse)));
$today = new DateTime(date("Y-m-d"));
if(isset($lastResponse))
{
$diff = $today->diff($dateCreated);
}
else
{
$diff = $today->diff($dateNotCreated);
}
}
echo 240 / 23;
Expected result:
----------------
Not NAN
Actual result:
--------------
NAN
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=52920&edit=1