From: Operating system: Windows Server 2008 R2 Enterpris PHP version: 5.3.3 Package: Date/time related Bug Type: Bug Bug description:Division equations are overridden
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 bug report at http://bugs.php.net/bug.php?id=52920&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=52920&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=52920&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=52920&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=52920&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=52920&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=52920&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=52920&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=52920&r=needscript Try newer version: http://bugs.php.net/fix.php?id=52920&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=52920&r=support Expected behavior: http://bugs.php.net/fix.php?id=52920&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=52920&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=52920&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=52920&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=52920&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=52920&r=dst IIS Stability: http://bugs.php.net/fix.php?id=52920&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=52920&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=52920&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=52920&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=52920&r=mysqlcfg