From c77625988d3e72bfe6c4c14c15a57e04998843fd Mon Sep 17 00:00:00 2001 From: louhde Date: Wed, 4 Jul 2018 17:38:36 +0200 Subject: [PATCH] [Security] LdapUserProvider uidKey could be null --- .../Component/Security/Core/User/LdapUserProvider.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Security/Core/User/LdapUserProvider.php b/src/Symfony/Component/Security/Core/User/LdapUserProvider.php index b3fa3fa6b94f..5f47fe8923b9 100644 --- a/src/Symfony/Component/Security/Core/User/LdapUserProvider.php +++ b/src/Symfony/Component/Security/Core/User/LdapUserProvider.php @@ -35,8 +35,12 @@ class LdapUserProvider implements UserProviderInterface private $defaultSearch; private $passwordAttribute; - public function __construct(LdapInterface $ldap, string $baseDn, string $searchDn = null, string $searchPassword = null, array $defaultRoles = array(), string $uidKey = 'sAMAccountName', string $filter = '({uid_key}={username})', string $passwordAttribute = null) + public function __construct(LdapInterface $ldap, string $baseDn, string $searchDn = null, string $searchPassword = null, array $defaultRoles = array(), ?string $uidKey = 'sAMAccountName', string $filter = '({uid_key}={username})', string $passwordAttribute = null) { + if (null === $uidKey) { + $uidKey = 'sAMAccountName'; + } + $this->ldap = $ldap; $this->baseDn = $baseDn; $this->searchDn = $searchDn;