Edit report at http://bugs.php.net/bug.php?id=52920&edit=1
ID: 52920 Updated by: [email protected] Reported by: michael at nerdalert dot biz Summary: Multiple datetime affects divisions -Status: Open +Status: Feedback Type: Bug Package: Date/time related Operating System: Windows Server 2008 R2 Enterpris PHP Version: 5.3.3 Block user comment: N New Comment: I can't reproduce this with PHP 5.3.3. What binaries are you using? (thread safety or not, vc6 or vc9) Previous Comments: ------------------------------------------------------------------------ [2010-09-24 17:27:33] michael at nerdalert dot biz Changing the title only ------------------------------------------------------------------------ [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
