From: evert at rooftopsolutions dot nl
Operating system: Debian
PHP version: 5.2.10
PHP Bug Type: Date/time related
Bug description: strtotime very slow with large values
Description:
------------
strtotime is very slow with very large values.
Reproduce code:
---------------
php -r "echo strtotime('-50000000000 days');"
also, to clearly see this function has O(n) instead of O(1) complexity.
for x in {1..40}; do php -r "echo $x, \"\t\", pow ( 2, $x ), \"\t\",
strtotime ( ( -1 * pow ( 2, $x ) ) . ' days' ), \"\n\";" 2> /dev/null;
done;
Regardless of the fact you won't often work with dates 130 million years
ago, this could be used to trigger a dos-like attack.
Expected result:
----------------
Quick results
Actual result:
--------------
veryyy slow results :)
--
Edit bug report at http://bugs.php.net/?id=48611&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=48611&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=48611&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=48611&r=trysnapshot60
Fixed in CVS:
http://bugs.php.net/fix.php?id=48611&r=fixedcvs
Fixed in CVS and need be documented:
http://bugs.php.net/fix.php?id=48611&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=48611&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=48611&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=48611&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=48611&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=48611&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=48611&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=48611&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=48611&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=48611&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=48611&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=48611&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=48611&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=48611&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=48611&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=48611&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=48611&r=mysqlcfg