From defac0ff0d13c759b70504cf16c0d51b4d36ee1e Mon Sep 17 00:00:00 2001
From: Morris Jobke <hey@morrisjobke.de>
Date: Wed, 13 Dec 2017 11:57:46 +0100
Subject: [PATCH] Fixes hex2bin() in LDAP

Untangles the two if-else clauses into a more readable format.

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
---
 apps/user_ldap/lib/Access.php | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/apps/user_ldap/lib/Access.php b/apps/user_ldap/lib/Access.php
index 95710cd37f2..27fda38a737 100644
--- a/apps/user_ldap/lib/Access.php
+++ b/apps/user_ldap/lib/Access.php
@@ -1253,11 +1253,13 @@ class Access extends LDAPUtility implements IUserTools {
 							unset($item[$key]['count']);
 						}
 						if($key !== 'dn') {
-							$selection[$i][$key] = $this->resemblesDN($key) ?
-								$this->helper->sanitizeDN($item[$key])
-								: $key === 'objectguid' || $key === 'guid' ?
-									$selection[$i][$key] = $this->convertObjectGUID2Str($item[$key])
-									: $item[$key];
+							if($this->resemblesDN($key)) {
+								$selection[$i][$key] = $this->helper->sanitizeDN($item[$key]);
+							} else if($key === 'objectguid' || $key === 'guid') {
+								$selection[$i][$key] = [$this->convertObjectGUID2Str($item[$key][0])];
+							} else {
+								$selection[$i][$key] = $item[$key];
+							}
 						} else {
 							$selection[$i][$key] = [$this->helper->sanitizeDN($item[$key])];
 						}
-- 
GitLab