From: wavetrex at gmail dot com Operating system: Windows 2003 Server PHP version: 5.3.0RC2 PHP Bug Type: Date/time related Bug description: DateTime::diff() corrupting microtime() result
Description: ------------ calling DateTime::diff() seems to corrupt the result returned by microtime(), so it returns the wrong time after this function has been called Reproduce code: --------------- <?php // two arbitrary dates $date1=new DateTime("2005-07-23"); $date2=new DateTime("2006-02-14"); echo "<pre>"; var_dump(microtime()); var_dump(time()); var_dump(date(DATE_ATOM)); var_dump($date1->diff($date2)); var_dump(microtime()); var_dump(time()); var_dump(date(DATE_ATOM)); echo "</pre>"; ?> Expected result: ---------------- Expecting the 2nd microtime to be slightly bigger ( by a few miliseconds ) than first. instead, it's a totally wrong 50000 seconds distance (or maybe other arbitrary value) date() and time() seem to be unaffected Actual result: -------------- before calling diff: string(21) "0.98425000 1241761004" after it: string(21) "0.25882200 1241709345" -- Edit bug report at http://bugs.php.net/?id=48187&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=48187&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=48187&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=48187&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=48187&r=fixedcvs Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=48187&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=48187&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=48187&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=48187&r=needscript Try newer version: http://bugs.php.net/fix.php?id=48187&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=48187&r=support Expected behavior: http://bugs.php.net/fix.php?id=48187&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=48187&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=48187&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=48187&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=48187&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=48187&r=dst IIS Stability: http://bugs.php.net/fix.php?id=48187&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=48187&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=48187&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=48187&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=48187&r=mysqlcfg