diff options
author | Aleksander Machniak <alec@alec.pl> | 2022-02-07 16:33:21 +0300 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2022-02-07 16:33:21 +0300 |
commit | 00c5a585db504b74bd72737055dfd18ee5e5ef39 (patch) | |
tree | 3b6e8d3d7550609d565dd9cbd405d69ae47ce307 | |
parent | fa7f6a749cafeb56298b305973ec3b4789a68f82 (diff) |
FIx PHP8 warnings (#8437)
-rw-r--r-- | program/lib/Roundcube/rcube_ldap.php | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/program/lib/Roundcube/rcube_ldap.php b/program/lib/Roundcube/rcube_ldap.php index 9865ffe9f..651a6d088 100644 --- a/program/lib/Roundcube/rcube_ldap.php +++ b/program/lib/Roundcube/rcube_ldap.php @@ -142,7 +142,7 @@ class rcube_ldap extends rcube_addressbook // use fieldmap to advertise supported coltypes to the application foreach ($this->fieldmap as $colv => $lfv) { - list($col, $type) = explode(':', $colv); + list($col, $type) = rcube_utils::explode(':', $colv); $params = explode(':', $lfv); $lf = array_shift($params); @@ -164,7 +164,7 @@ class rcube_ldap extends rcube_addressbook } } - if (!is_array($this->coltypes[$col])) { + if (!isset($this->coltypes[$col]) || !is_array($this->coltypes[$col])) { $subtypes = $type ? [$type] : null; $this->coltypes[$col] = ['limit' => $limit, 'subtypes' => $subtypes, 'attributes' => [$lf]]; } @@ -1637,7 +1637,7 @@ class rcube_ldap extends rcube_addressbook continue; } - list($col, $subtype) = explode(':', $rf); + list($col, $subtype) = rcube_utils::explode(':', $rf); $out['_raw_attrib'][$lf][$i] = $value; if ($col == 'email' && $this->mail_domain && !strpos($value, '@')) { @@ -1714,7 +1714,7 @@ class rcube_ldap extends rcube_addressbook $val = $save_cols[$rf]; // check for value in base field (e.g. email instead of email:foo) - list($col, $subtype) = explode(':', $rf); + list($col, $subtype) = rcube_utils::explode(':', $rf); if (!$val && !empty($save_cols[$col])) { $val = $save_cols[$col]; unset($save_cols[$col]); // use this value only once @@ -1754,7 +1754,7 @@ class rcube_ldap extends rcube_addressbook /** * Returns unified attribute name (resolving aliases) */ - private static function _attr_name($namev) + private static function _attr_name($name) { // list of known attribute aliases static $aliases = [ @@ -1765,9 +1765,14 @@ class rcube_ldap extends rcube_addressbook 'pkcs9email' => 'email', ]; - list($name, $limit) = explode(':', $namev, 2); - $suffix = $limit ? ':'.$limit : ''; - $name = strtolower($name); + $suffix = ''; + + if (strpos($name, ':')) { + list($name, $limit) = explode(':', $name, 2); + $suffix = $limit ? ":$limit" : ''; + } + + $name = strtolower($name); return ($aliases[$name] ?? $name) . $suffix; } |