A free open source IT asset/license management system
return an error from ldap_search (#4623)
Ryan9a40e5e651b0
diff --git a/app/Console/Commands/LdapSync.php b/app/Console/Commands/LdapSync.phpindex 6ebfe62192..bff3b72328 100755--- a/app/Console/Commands/LdapSync.php+++ b/app/Console/Commands/LdapSync.php@@ -67,8 +67,17 @@ class LdapSync extends Command$summary = array();- $results = Ldap::findLdapUsers();-+ try {+ $results = Ldap::findLdapUsers();+ } catch (\Exception $e) {+ if ($this->option('json_summary')) {+ $json_summary = [ "error" => true, "error_message" => $e->getMessage(), "summary" => [] ];+ $this->info(json_encode($json_summary));+ }+ LOG::error($e);+ return [];+ }+// Retrieve locations with a mapped OU, and sort them from the shallowest to deepest OU (see #3993)$ldap_ou_locations = Location::where('ldap_ou', '!=', '')->get()->toArray();$ldap_ou_lengths = array();