Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8a96fdc

Browse files
author
Robin Chalas
committed
bug #27847 [Security] Fix accepting null as $uidKey in LdapUserProvider (louhde)
This PR was merged into the 4.0 branch. Discussion ---------- [Security] Fix accepting null as $uidKey in LdapUserProvider | Q | A | ------------- | --- | Branch? | 4.0 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - Fixing the hard BC break introduced in afeb89f#diff-96df7b4cb1c79ec0877d79ae2b61899dL40 Commits ------- c776259 [Security] LdapUserProvider uidKey could be null
2 parents 4ce5a1b + c776259 commit 8a96fdc

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Symfony/Component/Security/Core/User/LdapUserProvider.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,12 @@ class LdapUserProvider implements UserProviderInterface
3535
private $defaultSearch;
3636
private $passwordAttribute;
3737

38-
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)
38+
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)
3939
{
40+
if (null === $uidKey) {
41+
$uidKey = 'sAMAccountName';
42+
}
43+
4044
$this->ldap = $ldap;
4145
$this->baseDn = $baseDn;
4246
$this->searchDn = $searchDn;

0 commit comments

Comments
 (0)