Skip to content
Browse files

fixed getEntry()

git-svn-id: http://svn.php.net/repository/pear/packages/Net_LDAP/trunk@145012 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information...
1 parent 2efd9a0 commit 09a28907453fdec7ad6a883cfd1a7926fdd6c892 Jan Wagner committed
Showing with 9 additions and 10 deletions.
  1. +9 −10 LDAP.php
View
19 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;
+ }
/**

0 comments on commit 09a2890

Please sign in to comment.
Something went wrong with that request. Please try again.