Bug #52920 [Opn]: Multiple datetime affects divisions

From: Date: Fri, 24 Sep 2010 15:27:35 +0000
Subject: Bug #52920 [Opn]: Multiple datetime affects divisions
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-154614@lists.php.net to get a copy of this message
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

« previous php.bugs (#154614) next »