Fix PHP error when using Net_LDAP3 from master

get_entry() method signature has changed. We don't really needed
that override in rcube_ldap_generic, so it's now removed.
pull/6841/head
Aleksander Machniak 6 years ago committed by Aleksander Machniak
parent 37f4c7df77
commit 1cd1990053

@ -1009,7 +1009,7 @@ class rcube_ldap extends rcube_addressbook
if ($this->ready && $dn) {
$dn = self::dn_decode($dn);
if ($rec = $this->ldap->get_entry($dn)) {
if ($rec = $this->ldap->get_entry($dn, $this->prop['attributes'])) {
$rec = array_change_key_case($rec, CASE_LOWER);
}
@ -1530,8 +1530,15 @@ class rcube_ldap extends rcube_addressbook
foreach ($fieldmap as $rf => $lf)
{
for ($i=0; $i < $rec[$lf]['count']; $i++) {
if (!($value = $rec[$lf][$i]))
// we might be dealing with normalized and non-normalized data
$entry = $rec[$lf];
if (!is_array($entry) || !isset($entry['count'])) {
$entry = (array) $entry;
$entry['count'] = count($entry);
}
for ($i=0; $i < $entry['count']; $i++) {
if (!($value = $entry[$i]))
continue;
list($col, $subtype) = explode(':', $rf);
@ -1543,7 +1550,7 @@ class rcube_ldap extends rcube_addressbook
$out['address' . ($subtype ? ':' : '') . $subtype][$i][$col] = $value;
else if ($col == 'address' && strpos($value, '$') !== false) // address data is represented as string separated with $
list($out[$rf][$i]['street'], $out[$rf][$i]['locality'], $out[$rf][$i]['zipcode'], $out[$rf][$i]['country']) = explode('$', $value);
else if ($rec[$lf]['count'] > 1)
else if ($entry['count'] > 1)
$out[$rf][] = $value;
else
$out[$rf] = $value;

@ -54,19 +54,6 @@ class rcube_ldap_generic extends Net_LDAP3
return parent::connect($host);
}
/**
* Get a specific LDAP entry, identified by its DN
*
* @param string $dn Record identifier
* @param array $attributes Attributes to return
*
* @return array Hash array
*/
function get_entry($dn, $attributes = array())
{
return parent::get_entry($dn, !empty($attributes) ? $attributes : $this->attributes);
}
/**
* Prints debug/error info to the log
*/

Loading…
Cancel
Save