Fix PHP 7.2 error: count(): Parameter must be an array or an object that implements Countable

pull/6072/head
Aleksander Machniak 7 years ago
parent ac5c9dd734
commit 988ce31748

@ -381,9 +381,9 @@ class rcube_vcard
}
if (($tag = self::$fieldmap[$field]) && (is_array($value) || strlen($value))) {
$index = count($this->raw[$tag]);
$this->raw[$tag][$index] = (array)$value;
$this->raw[$tag][] = (array) $value;
if ($type) {
$index = count($this->raw[$tag]) - 1;
$typemap = array_flip($this->typemap);
$this->raw[$tag][$index]['type'] = explode(',', $typemap[$type_uc] ?: $type);
}
@ -405,7 +405,7 @@ class rcube_vcard
*/
public function set_raw($tag, $value, $append = false)
{
$index = $append ? count($this->raw[$tag]) : 0;
$index = $append && isset($this->raw[$tag]) ? count($this->raw[$tag]) : 0;
$this->raw[$tag][$index] = (array)$value;
}

Loading…
Cancel
Save