Skip to content

A free open source IT asset/license management system

Fixed #5078 - check for object or array as location in LDAP sync

snipe04d2542b8171
diff --git a/app/Console/Commands/LdapSync.php b/app/Console/Commands/LdapSync.php
index e0e001a997..7b7571bf40 100755
--- a/app/Console/Commands/LdapSync.php
+++ b/app/Console/Commands/LdapSync.php
@@ -190,7 +190,13 @@ class LdapSync extends Command
if ($item['ldap_location_override'] == true) {
$user->location_id = $item['location_id'];
} elseif ((isset($location)) && (!empty($location))) {
- $user->location_id = e($location->id);
+
+ if (is_array($location)) {
+ $user->location_id = $location['id'];
+ } elseif (is_object($location)) {
+ $user->location_id = $location->id;
+ }
+
}
$user->notes = 'Imported from LDAP';