diff --git a/src/Symfony/Component/Ldap/Security/LdapUser.php b/src/Symfony/Component/Ldap/Security/LdapUser.php index ef73b82422d0b..020fcb5441596 100644 --- a/src/Symfony/Component/Ldap/Security/LdapUser.php +++ b/src/Symfony/Component/Ldap/Security/LdapUser.php @@ -47,7 +47,7 @@ public function getRoles(): array public function getPassword(): ?string { - return $this->password; + return $this->password ?? null; } public function getSalt(): ?string @@ -89,7 +89,7 @@ public function isEqualTo(UserInterface $user): bool return false; } - if ($this->getPassword() !== $user->getPassword()) { + if (($this->getPassword() ?? $user->getPassword()) !== $user->getPassword()) { return false; } diff --git a/src/Symfony/Component/Ldap/Tests/Security/LdapUserTest.php b/src/Symfony/Component/Ldap/Tests/Security/LdapUserTest.php new file mode 100644 index 0000000000000..0a696bcd0c29d --- /dev/null +++ b/src/Symfony/Component/Ldap/Tests/Security/LdapUserTest.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Ldap\Tests\Security; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\Ldap\Entry; +use Symfony\Component\Ldap\Security\LdapUser; + +class LdapUserTest extends TestCase +{ + public function testIsEqualToWorksOnUnserializedUser() + { + $user = new LdapUser(new Entry('uid=jonhdoe,ou=MyBusiness,dc=symfony,dc=com', []), 'jonhdoe', 'p455w0rd'); + $unserializedUser = unserialize(serialize($user)); + + $this->assertTrue($unserializedUser->isEqualTo($user)); + } +} pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy