ID:               48611
 Updated by:       scott...@php.net
 Reported By:      evert at rooftopsolutions dot nl
-Status:           Open
+Status:           Feedback
 Bug Type:         Date/time related
 Operating System: Debian
 PHP Version:      5.2.10
 New Comment:

Please try using this CVS snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/

Pretty sure this is fixed in 5.3


Previous Comments:
------------------------------------------------------------------------

[2009-06-19 19:13:39] evert at rooftopsolutions dot nl

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 this bug report at http://bugs.php.net/?id=48611&edit=1

Reply via email to