Prevent from PHP warning when search string is empty

This commit is contained in:
Aleksander Machniak (Kolab Systems) 2011-07-21 18:21:55 +02:00
parent cdca86d15b
commit 480993ec15

View file

@ -363,6 +363,8 @@ class rcube_kolab_contacts extends rcube_addressbook
$search = $value;
}
$s_len = strlen($search);
foreach ((array)$contact[$col] as $val) {
// composite field, e.g. address
if (is_array($val)) {
@ -370,7 +372,9 @@ class rcube_kolab_contacts extends rcube_addressbook
}
$val = mb_strtolower($val);
if (($strict && $val == $search) || (!$strict && strpos($val, $search) !== false)) {
if (($strict && $val == $search)
|| (!$strict && $s_len && strpos($val, $search) !== false)
) {
if (!$advanced) {
$this->filter['ids'][] = $id;
break 2;