diff --git a/src/Service/LDAPApi.php b/src/Service/LDAPApi.php index cac8b9e8836c0a147e4771cb48862a0968f610bb..07d23719888840cf27fad122a0acb61739cbafe1 100644 --- a/src/Service/LDAPApi.php +++ b/src/Service/LDAPApi.php @@ -264,12 +264,12 @@ class LDAPApi implements LoggerAwareInterface, ServiceSubscriberInterface // $this->dispatcher->dispatch($preEvent, PersonFromUserItemPreEvent::NAME); // $user = $preEvent->getUser(); - $identifier = $user->getFirstAttribute($this->identifierAttributeName); + $identifier = $user->getFirstAttribute($this->identifierAttributeName) ?? ''; $person = new Person(); $person->setIdentifier($identifier); - $person->setGivenName($user->getFirstAttribute($this->givenNameAttributeName)); - $person->setFamilyName($user->getFirstAttribute($this->familyNameAttributeName)); + $person->setGivenName($user->getFirstAttribute($this->givenNameAttributeName) ?? ''); + $person->setFamilyName($user->getFirstAttribute($this->familyNameAttributeName) ?? ''); if ($this->emailAttributeName !== '') { $person->setEmail($user->getFirstAttribute($this->emailAttributeName) ?? '');