Merge pull request #4046 from Icinga/fix/error-on-incomplete-inspection-4026

Fix error on incomplete ldap inspection
This commit is contained in:
Johannes Meyer 2020-01-14 11:11:53 +01:00 committed by GitHub
commit b8975b256a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 4 deletions

View File

@ -321,7 +321,7 @@ class ResourceConfigForm extends ConfigForm
$inspection = static::inspectResource($this);
if ($inspection !== null) {
$join = function ($e) use (&$join) {
return is_string($e) ? $e : join("\n", array_map($join, $e));
return is_array($e) ? join("\n", array_map($join, $e)) : $e;
};
$this->addElement(
'note',

View File

@ -398,7 +398,7 @@ class UserBackendConfigForm extends ConfigForm
$inspection = static::inspectUserBackend($this);
if ($inspection !== null) {
$join = function ($e) use (&$join) {
return is_string($e) ? $e : join("\n", array_map($join, $e));
return is_array($e) ? join("\n", array_map($join, $e)) : $e;
};
$this->addElement(
'note',

View File

@ -230,7 +230,7 @@ class UserGroupBackendForm extends ConfigForm
$inspection = static::inspectUserBackend($this);
if ($inspection !== null) {
$join = function ($e) use (&$join) {
return is_string($e) ? $e : join("\n", array_map($join, $e));
return is_array($e) ? join("\n", array_map($join, $e)) : $e;
};
$this->addElement(
'note',

View File

@ -1533,7 +1533,10 @@ class LdapConnection implements Selectable, Inspectable
try {
$cap = LdapCapabilities::discoverCapabilities($this);
$discovery = new Inspection('Discovery Results');
$discovery->write($cap->getVendor());
$vendor = $cap->getVendor();
if (isset($vendor)) {
$discovery->write($vendor);
}
$version = $cap->getVersion();
if (isset($version)) {
$discovery->write($version);