# With PHP 7 hexadecimal strings are no longer considered numerical # http://php.net/manual/en/migration70.incompatible.php#migration70.incompatible.strings.hex # This patch uses filter_var for parsing the color definitions. --- a/html/includes/collectd/functions.php +++ b/html/includes/collectd/functions.php @@ -414,9 +414,11 @@ if ($value == 'random') { $this->randomize(); } else if (preg_match('/([0-9A-Fa-f][0-9A-Fa-f])([0-9A-Fa-f][0-9A-Fa-f])([0-9A-Fa-f][0-9A-Fa-f])/', $value, $matches)) { - $this->r = ('0x'.$matches[1]) / 255.0; - $this->g = ('0x'.$matches[2]) / 255.0; - $this->b = ('0x'.$matches[3]) / 255.0; + $capture_map = array('r' => 1, 'g' => 2, 'b' => 3); + foreach ($capture_map as $k => $v) { + $hexval = filter_var('0x'.$matches[$v], FILTER_VALIDATE_INT, FILTER_FLAG_ALLOW_HEX); + $this->$k = $hexval / 255.0; + } } } else if (is_a($value, 'CollectdColor')) { $this->r = $value->r;