From 143f1c353409e347703a5af61d1986e33b8d82c1 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak <machniak@kolabsys.com> Date: Fri, 28 Jul 2023 11:59:21 +0200 Subject: [PATCH] Fix "Undefined wariable" warning --- lib/Net/LDAP3.php | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/lib/Net/LDAP3.php b/lib/Net/LDAP3.php index a4e3bca..8d908a6 100644 --- a/lib/Net/LDAP3.php +++ b/lib/Net/LDAP3.php @@ -3179,6 +3179,7 @@ class Net_LDAP3 // use cache $domain_dn = $this->get_cache_data($ckey); + $result = false; if ($domain_dn) { $result = $this->get_entry_attributes($domain_dn, $attributes); @@ -3186,9 +3187,6 @@ class Net_LDAP3 if (!empty($result)) { $result['dn'] = $domain_dn; } - else { - $result = false; - } } else if ($domain_base_dn = $this->config_get('domain_base_dn')) { $domain_filter = $this->config_get('domain_filter'); @@ -3209,10 +3207,7 @@ class Net_LDAP3 $result = $result->entries(true); $domain_dn = key($result); - if (empty($domain_dn)) { - $result = false; - } - else { + if (!empty($domain_dn)) { $result = $result[$domain_dn]; $result['dn'] = $domain_dn; -- GitLab