aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/type
diff options
context:
space:
mode:
authorPeter Wu2014-07-20 15:59:51 +0200
committerPeter Wu2014-07-20 23:23:24 +0200
commitb7be6ba7ed302e18a313af4cbb2827b1fb62193a (patch)
treec262da09f5fe403ed5657e9ee84d5a22abb0acfb /type
parentDefensive programming: more urlencode/htmlentities (diff)
downloadapt-panopticon_cgp-b7be6ba7ed302e18a313af4cbb2827b1fb62193a.zip
apt-panopticon_cgp-b7be6ba7ed302e18a313af4cbb2827b1fb62193a.tar.gz
apt-panopticon_cgp-b7be6ba7ed302e18a313af4cbb2827b1fb62193a.tar.bz2
apt-panopticon_cgp-b7be6ba7ed302e18a313af4cbb2827b1fb62193a.tar.xz
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.
Diffstat (limited to 'type')
-rw-r--r--type/Base.class.php6
1 files changed, 5 insertions, 1 deletions
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 {
155 function rrd_files() { 155 function rrd_files() {
156 $files = $this->get_filenames(); 156 $files = $this->get_filenames();
157 157
158 $this->tinstances = array();
159 $this->files = array();
160 $this->identifiers = array();
161
158 foreach($files as $filename) { 162 foreach($files as $filename) {
159 $basename=basename($filename,'.rrd'); 163 $basename=basename($filename,'.rrd');
160 $instance = strpos($basename,'-') 164 $instance = strpos($basename,'-')
@@ -186,7 +190,7 @@ class Type_Base {
186 190
187 $files = glob($this->datadir .'/'. $identifier . $wildcard . 'rrd'); 191 $files = glob($this->datadir .'/'. $identifier . $wildcard . 'rrd');
188 192
189 return $files; 193 return $files ? $files : array();
190 } 194 }
191 195
192 function rrd_graph($debug = false) { 196 function rrd_graph($debug = false) {