|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-06-20 01:24 UTC] scottmac@php.net
[2009-06-28 01:00 UTC] php-bugs at lists dot php dot net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 20:00:01 2025 UTC |
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 :)