From 78170213d2ba3db2a3093a9e92a3a19e5412c546 Mon Sep 17 00:00:00 2001 From: jaroug Date: Wed, 20 Jul 2016 12:49:38 +0200 Subject: [PATCH] fix: strstr won't return anything if nfsensuffix is empty --- html/includes/graphs/device/nfsen_common.inc.php | 2 +- html/pages/device.inc.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/html/includes/graphs/device/nfsen_common.inc.php b/html/includes/graphs/device/nfsen_common.inc.php index c51d7dcd95..918fe4ca08 100644 --- a/html/includes/graphs/device/nfsen_common.inc.php +++ b/html/includes/graphs/device/nfsen_common.inc.php @@ -18,7 +18,7 @@ foreach ($config['nfsen_rrds'] as $nfsenrrds) { } $basefilename_underscored = preg_replace('/\./', $config['nfsen_split_char'], $device['hostname']); - $nfsen_filename = (strstr($basefilename_underscored, $nfsensuffix, true)); + $nfsen_filename = preg_replace('/'.$nfsensuffix.'/', '', $basefilename_underscored); if (is_file($nfsenrrds.$nfsen_filename.'.rrd')) { $rrd_filename = $nfsenrrds.$nfsen_filename.'.rrd'; diff --git a/html/pages/device.inc.php b/html/pages/device.inc.php index 33d643510e..b6682eeb2e 100644 --- a/html/pages/device.inc.php +++ b/html/pages/device.inc.php @@ -370,7 +370,7 @@ if (device_permitted($vars['device']) || $check_device == $vars['device']) { } $basefilename_underscored = preg_replace('/\./', $config['nfsen_split_char'], $device['hostname']); - $nfsen_filename = (strstr($basefilename_underscored, $nfsensuffix, true)); + $nfsen_filename = preg_replace('/'.$nfsensuffix.'/', '', $basefilename_underscored); if (is_file($nfsenrrds.$nfsen_filename.'.rrd')) { $nfsen_rrd_file = $nfsenrrds.$nfsen_filename.'.rrd'; }