diff --git a/src/Symfony/Component/Ldap/LdapClient.php b/src/Symfony/Component/Ldap/LdapClient.php index e7a0bc45e64d9..06c9ccceaf07f 100644 --- a/src/Symfony/Component/Ldap/LdapClient.php +++ b/src/Symfony/Component/Ldap/LdapClient.php @@ -84,8 +84,17 @@ public function find($dn, $query, $filter = '*') } $search = ldap_search($this->connection, $dn, $query, $filter); + + if (false === $search) { + throw new LdapException(ldap_error($this->connection)); + } + $infos = ldap_get_entries($this->connection, $search); + if (false === @ldap_free_result($search)) { + throw new LdapException(ldap_error($this->connection)); + } + if (0 === $infos['count']) { return; }