From 2109fc94fb310f24d89ff3738225099936d942cc Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Wed, 21 Jan 2015 04:31:36 -0500
Subject: [PATCH] Fix bug where empty fieldmap config entries caused empty results of ldap search (#1490229)

---
 program/lib/Roundcube/rcube_ldap.php |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/program/lib/Roundcube/rcube_ldap.php b/program/lib/Roundcube/rcube_ldap.php
index b3872e2..1f12cae 100644
--- a/program/lib/Roundcube/rcube_ldap.php
+++ b/program/lib/Roundcube/rcube_ldap.php
@@ -116,13 +116,14 @@
 
         // fieldmap property is given
         if (is_array($p['fieldmap'])) {
+            $p['fieldmap'] = array_filter($p['fieldmap']);
             foreach ($p['fieldmap'] as $rf => $lf)
                 $this->fieldmap[$rf] = $this->_attr_name(strtolower($lf));
         }
         else if (!empty($p)) {
             // read deprecated *_field properties to remain backwards compatible
             foreach ($p as $prop => $value)
-                if (preg_match('/^(.+)_field$/', $prop, $matches))
+                if (!empty($value) && preg_match('/^(.+)_field$/', $prop, $matches))
                     $this->fieldmap[$matches[1]] = $this->_attr_name(strtolower($value));
         }
 

--
Gitblit v1.9.1