overrides `customvarsWithOriginalNames` only if the given object is of type `host`
A call to `__get()` reset the array if the given `$name` is a customvar If `service` has a `host` customvar filter, the `fetchHostVariables()` method was executed and overwrote the `customvarsWithOriginalNames` array. fixes #4757
This commit is contained in:
parent
c0d247613d
commit
d8ddc6600a
|
@ -539,7 +539,11 @@ abstract class MonitoredObject implements Filterable
|
||||||
->whereEx(new FilterEqual('host_name', '=', $this->host_name));
|
->whereEx(new FilterEqual('host_name', '=', $this->host_name));
|
||||||
|
|
||||||
$this->hostVariables = [];
|
$this->hostVariables = [];
|
||||||
$this->customvarsWithOriginalNames = [];
|
|
||||||
|
if ($this->type === static::TYPE_HOST) {
|
||||||
|
$this->customvarsWithOriginalNames = [];
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($query as $row) {
|
foreach ($query as $row) {
|
||||||
if ($row->is_json) {
|
if ($row->is_json) {
|
||||||
$this->hostVariables[strtolower($row->varname)] = json_decode($row->varvalue);
|
$this->hostVariables[strtolower($row->varname)] = json_decode($row->varvalue);
|
||||||
|
|
Loading…
Reference in New Issue