Fix error "explode(): Argument #2 ($string) must be of type string, array given", happens sometimes while merging contacts

This commit is contained in:
Hadi Nategh 2022-03-22 10:54:44 +01:00
parent 14efc30663
commit 65eda2c1d8

View File

@ -1123,7 +1123,7 @@ class Base
$criteria[$col] = substr($criteria[$col],1); $criteria[$col] = substr($criteria[$col],1);
$negate = true; $negate = true;
} }
foreach(explode(' ',$criteria[$col]) as $crit) foreach((is_array($criteria[$col]) ? $criteria[$col] : explode(' ',$criteria[$col])) as $crit)
{ {
$query[] = ($negate ? ' ('.$table_name.$db_col.' IS NULL OR ' : '').$table_name.$db_col.$cmp_op. $query[] = ($negate ? ' ('.$table_name.$db_col.' IS NULL OR ' : '').$table_name.$db_col.$cmp_op.
$this->db->quote($wildcard.str_replace(array('%','_','*','?'),array('\\%','\\_','%','_'),$crit).$wildcard). $this->db->quote($wildcard.str_replace(array('%','_','*','?'),array('\\%','\\_','%','_'),$crit).$wildcard).