From 7da445307cfa50cffe0a7e37ce07e9e48845a909 Mon Sep 17 00:00:00 2001 From: Hidde Wieringa Date: Sat, 9 Apr 2016 16:24:30 +0200 Subject: [PATCH] [LDAP] Free the search result after a search to free memory Fixed error handling in ldap_search and ldap_free Added spaces around if Fixed trailing spaces Added functional tests for Ldap component Fixed style errors Fixed style errors 2 Added slapd to Travis requirements Added mkdir /tmp/travis to Travis build config Revert "Added mkdir /tmp/travis to Travis build config" This reverts commit d7f1884e6dc53602ad8dca6caeabb423445166cc. Revert "Added slapd to Travis requirements" This reverts commit 9b212ff5eb9fc2f4d6d54b787e4d307b0e164e21. Revert "Fixed style errors 2" This reverts commit cbe0c168d6c9a50dac1ba6593113573f53768be3. Revert "Fixed style errors" This reverts commit a2dc110f3df1b9e803447b94d2794eb1a3e8c300. Revert "Added functional tests for Ldap component" This reverts commit 33a67230dd25dabdb454381a3cdee95bdaac7f30. --- src/Symfony/Component/Ldap/LdapClient.php | 9 +++++++++ 1 file changed, 9 insertions(+) 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; }