ZF-12152: High time of execution when adding/substracing days/months or years by Zend_Date functions
Description
Lets look at the following code: {color:gray} <?php include('Zend/Date.php');
$value = 10000000;
$date = new Zend_Date(time()); $date->addMonth($value); {color}
Here are values and time of execution pairs (tested on Intel(R) Core(TM) i7 CPU 920 @ 2.67GHz)
| value | time of execution | | 10000000 | 3.049s | | 100000000 | 36.241s | | 1000000000 | 5m 34.667s |
Profiler said that function which takes 99% time of execution is getDateParts of Zend_Date_DateObject.
Note: When developer dont check range of input parameters DoS attack is possible (I was able to take down production live server by following simple bash script): {color:gray}
!/bin/bash
for i in {1..100} do url="http://www.example.com/search/age_to/99999999999999999$i"; wget $url & done {color}
Comments
No comments to display