From 09a28907453fdec7ad6a883cfd1a7926fdd6c892 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Fri, 28 Nov 2003 09:39:39 +0000 Subject: [PATCH] fixed getEntry() git-svn-id: http://svn.php.net/repository/pear/packages/Net_LDAP/trunk@145012 c90b9560-bf6c-de11-be94-00142212c4b1 --- LDAP.php | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/LDAP.php b/LDAP.php index c8cb065..8da1d7a 100644 --- a/LDAP.php +++ b/LDAP.php @@ -592,17 +592,16 @@ function dnExists($dn) */ function &getEntry($dn) { - $base = $dn; - $filter = '(objectclass=*)'; - $result = @ldap_list($this->_link, $base, $filter, array(), 1, 1); - if (ldap_count_entries($result) > 0) { - $elink = @ldap_first_entry($this->_link, $this->result); - return new Net_LDAP_Entry($this->_link, - @ldap_get_dn($this->_link, $elink), - @ldap_get_attributes($this->_link, $elink)); + $result = $this->search($dn, '(objectClass=*)', array('scope' => 'base', 'attributes' => null)); + if (Net_LDAP::isError($result)) { + return $result; } - return false; - } + $entry = $result->shift_entry(); + if (false == $entry) { + return $this->raiseError('Could not fetch entry'); + } + return $entry; + } /**