ID: 45866 Updated by: der...@php.net Reported By: jsnell at e-normous dot com -Status: Assigned +Status: Closed Bug Type: Date/time related Operating System: * PHP Version: 5CVS, 6CVS (2008-11-11) Assigned To: derick New Comment:
This bug has been fixed in SVN. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. The algorithm has been optimized some time ago, it's much faster now for these large values. The result is *also* correct as the given string is parsed as: "+1" (timezone offset) "." (ignored by default) "61538461538 day" (the jump forwards) I have a patch that adds warnings for *broken* strings though, but this breaks a few already existing tests: http://files.derickrethans.nl/patches/php-date-modify-warnings-2009-07-29.diff.txt Closing this report. Previous Comments: ------------------------------------------------------------------------ [2008-11-11 10:47:55] j...@php.net Happens in all branches. ------------------------------------------------------------------------ [2008-08-20 03:58:45] jsnell at e-normous dot com Description: ------------ Feeding a decimal value to DateTime's modify() function can cause very long execution times because the decimal point is ignored. Reproduced on the php5.3-200808200230 snapshot. Reproduce code: --------------- $date = new DateTime(); $date->modify("+1.61538461538 day"); Expected result: ---------------- A warning or exception, or perhaps 1 day + 0.61538461538*24 hours added. Actual result: -------------- after 32 seconds of execution, 161538461538 days are added to the date ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=45866&edit=1