From 6f49974851b035736df78ecc5efed3bd162127ae Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Mon, 15 Jun 2020 21:48:27 +0200 Subject: [PATCH 1/2] getXbyY can still return false, e.g. when using ldap write support Signed-off-by: Arthur Schiwon --- apps/user_ldap/lib/Mapping/AbstractMapping.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/apps/user_ldap/lib/Mapping/AbstractMapping.php b/apps/user_ldap/lib/Mapping/AbstractMapping.php index 6fd07f5f48..a4a3705e22 100644 --- a/apps/user_ldap/lib/Mapping/AbstractMapping.php +++ b/apps/user_ldap/lib/Mapping/AbstractMapping.php @@ -123,8 +123,7 @@ abstract class AbstractMapping { */ public function getDNByName($name) { $dn = array_search($name, $this->cache); - if ($dn === false) { - $dn = $this->getXbyY('ldap_dn', 'owncloud_name', $name); + if ($dn === false && $dn = $this->getXbyY('ldap_dn', 'owncloud_name', $name)) { $this->cache[$dn] = $name; } return $dn; From 8e02367453555d300a12fc9f55c9636dd8e28732 Mon Sep 17 00:00:00 2001 From: blizzz Date: Tue, 16 Jun 2020 10:55:51 +0200 Subject: [PATCH 2/2] be more clear about the condition Co-authored-by: Christoph Wurst --- apps/user_ldap/lib/Mapping/AbstractMapping.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/user_ldap/lib/Mapping/AbstractMapping.php b/apps/user_ldap/lib/Mapping/AbstractMapping.php index a4a3705e22..0daa4f1504 100644 --- a/apps/user_ldap/lib/Mapping/AbstractMapping.php +++ b/apps/user_ldap/lib/Mapping/AbstractMapping.php @@ -123,7 +123,7 @@ abstract class AbstractMapping { */ public function getDNByName($name) { $dn = array_search($name, $this->cache); - if ($dn === false && $dn = $this->getXbyY('ldap_dn', 'owncloud_name', $name)) { + if ($dn === false && ($dn = $this->getXbyY('ldap_dn', 'owncloud_name', $name)) !== false) { $this->cache[$dn] = $name; } return $dn;