summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <machniak@kolabsys.com>2015-04-02 13:35:56 (GMT)
committerAleksander Machniak <machniak@kolabsys.com>2015-04-02 13:35:56 (GMT)
commit780283f2b726350d8f4e7f4725bf3c113c08413d (patch)
tree79769a037c049f9ba1e56cd292e9380ca38547ac
parent64b4f7f81ef7e9f6a21bb6c72327120c95d8e214 (diff)
downloadNet_LDAP3-780283f2b726350d8f4e7f4725bf3c113c08413d.tar.gz
Fix find_domain() result when domain wasn't found (#4959)HEADmaster
-rw-r--r--lib/Net/LDAP3.php14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/Net/LDAP3.php b/lib/Net/LDAP3.php
index 4af66f3..2789bf6 100644
--- a/lib/Net/LDAP3.php
+++ b/lib/Net/LDAP3.php
@@ -3074,11 +3074,17 @@ class Net_LDAP3
if ($result = $this->search($domain_base_dn, $domain_filter, 'sub', $attributes)) {
$result = $result->entries(true);
$domain_dn = key($result);
- $result = $result[$domain_dn];
- $result['dn'] = $domain_dn;
- // cache domain DN
- $this->set_cache_data($ckey, $domain_dn);
+ if (empty($domain_dn)) {
+ $result = false;
+ }
+ else {
+ $result = $result[$domain_dn];
+ $result['dn'] = $domain_dn;
+
+ // cache domain DN
+ $this->set_cache_data($ckey, $domain_dn);
+ }
}
}