From b7be6ba7ed302e18a313af4cbb2827b1fb62193a Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Sun, 20 Jul 2014 15:59:51 +0200 Subject: Fix type confusion index.php expects that collectd_hosts() always return an array for array_diff. Since an empty array evaluates to FALSE anyway, do not change the type and just return the empty array. In base.php, if no files are returned, the loop is never called and three variables are not initialized. Do it now. --- type/Base.class.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'type/Base.class.php') diff --git a/type/Base.class.php b/type/Base.class.php index ff9a235..1f42f4f 100644 --- a/type/Base.class.php +++ b/type/Base.class.php @@ -155,6 +155,10 @@ class Type_Base { function rrd_files() { $files = $this->get_filenames(); + $this->tinstances = array(); + $this->files = array(); + $this->identifiers = array(); + foreach($files as $filename) { $basename=basename($filename,'.rrd'); $instance = strpos($basename,'-') @@ -186,7 +190,7 @@ class Type_Base { $files = glob($this->datadir .'/'. $identifier . $wildcard . 'rrd'); - return $files; + return $files ? $files : array(); } function rrd_graph($debug = false) { -- cgit v1.1