From 65eda2c1d8d27a3612028b899bc8aed9f88efff4 Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Tue, 22 Mar 2022 10:54:44 +0100 Subject: [PATCH] Fix error "explode(): Argument #2 ($string) must be of type string, array given", happens sometimes while merging contacts --- api/src/Storage/Base.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/src/Storage/Base.php b/api/src/Storage/Base.php index 072d3d2de7..91e683cc6d 100644 --- a/api/src/Storage/Base.php +++ b/api/src/Storage/Base.php @@ -1123,7 +1123,7 @@ class Base $criteria[$col] = substr($criteria[$col],1); $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. $this->db->quote($wildcard.str_replace(array('%','_','*','?'),array('\\%','\\_','%','_'),$crit).$wildcard).