ECSC / analogi

Graphical Web Interface for OSSEC
GNU General Public License v3.0
72 stars 35 forks source link

date() expects parameter 2 to be long #1

Closed ECSC closed 12 years ago

ECSC commented 12 years ago

PHP error reported by Brett: date() expects parameter 2 to be long, string given in analogi/php/index_graph.php on line 127

Potential fix is to replace the line $tmpdate=$rowchart['res_time'];

With $tmpdate=intval($rowchart['res_time']);

This bug is still UNDER TESTING !

Please report any other issues.

ECSC commented 12 years ago

I've been informed that the site still works when this error occurs.

I cannot replicate. Closed, if you experience this bug please let me know.

ChristianBeer commented 12 years ago

This has also occurred at my new installation of analogi with a fresh database an happened in toprare.php. Reason is that there is not enough data in the database to calculate the toprare alerts. So the second DB query returns nothing and because there is no retval check you end up with an empty date. In my case I fixed this by adding

if(trim($val)=="||") break;

after

$i=0;
$mainstring="";
foreach ($lastrare as $key => $val) {
ECSC commented 12 years ago

Many thanks Christian, I've always had a very well populated database and never really considered an empty database with this bug !!

I hope you don't mind, but reduce the line count I've gone with

if($i<$glb_indexsubtablelimit && trim($val)!="||"){

Again, I should be committing the changes very soon, thanks for your input :)