Hello,<br>My name is Stanislav Palatnik. I've applied for gsoc 2009. I've looked over some bugs and have a proposal to solve bug 0000853<br>Basically it doesn't check if the date was valid. <div><br>Current line: search.class.php</div>
<div><br>if (!empty($this->_dateStart) AND !empty($this->_dateEnd)) {</div><div><br></div><div><br>It works fine if the date format is valid. Even if you enter 1921-33-44 to 2034-22-33 it will still return the results. However, if the format is different IE 192-133-44 then you(well me at least) will get a rather pointless error message "Unfortunately, an error has occurred rendering this page. Please try again later."<br>
The simplest fix is including checkdate() in both the start and end dates</div><div><br>fixed line:</div><div><br> if (!empty($this->_dateStart) && !empty($this->_dateEnd) && checkdate($DE[1],$DE[2],$DE[0]) && checkdate($DS[1],$DS[2],$DS[0])) {</div>
<div><br></div><div>Another faster solution would be just to check if mkdate returns false</div><div><br></div><div><div> $startdate = mktime(0,0,0,$DS[1],$DS[2],$DS[0]);</div><div> $enddate = mktime(23,59,59,$DE[1],$DE[2],$DE[0]);</div>
<div> if($startdate!=false && $enddate!=false) $sql .= "AND (UNIX_TIMESTAMP({$_TABLES['comments']}.date) BETWEEN '$startdate' AND '$enddate') ";</div><div><br>
</div><div>For even faster peformance, explicity put !=false to make PHP use less guessing</div><br>--<br>Warmly,<br><br>Stanislav<br><br><br></div>