Provide a minimal valid array if there have are no blocked queries at all. Otherwise the output of the API is inconsistent.

This commit is contained in:
DL6ER
2016-12-28 13:48:28 +00:00
parent 8ae49e4914
commit 0c40cacc83
+10
View File
@@ -68,6 +68,16 @@
$domains_over_time = overTime10mins($dns_queries);
$ads_over_time = overTime10mins($ads_blocked);
// Provide a minimal valid array if there have are no blocked
// queries at all. Otherwise the output of the API is inconsistent.
if(count($ads_blocked) == 0)
{
$ads_over_time = [1 => 0];
}
print_r($domains_over_time);
alignTimeArrays($ads_over_time, $domains_over_time);
return Array(
'domains_over_time' => $domains_over_time,