From 2f3ecc59306b2363478f48c89ea131415d965025 Mon Sep 17 00:00:00 2001
From: JediKev <kevin@enhancesoft.com>
Date: Fri, 31 Aug 2018 10:38:37 -0500
Subject: [PATCH] oops: Selection Search Bug

This addresses an issue introduced with 4124 where searching for a Selection
Field with the criteria "does not have a value" throws an `implode()`
warning.
---
 include/class.dynamic_forms.php | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/class.dynamic_forms.php b/include/class.dynamic_forms.php
index 6d654d8a3..9e5ece671 100644
--- a/include/class.dynamic_forms.php
+++ b/include/class.dynamic_forms.php
@@ -1822,7 +1822,9 @@ class SelectionField extends FormField {
 
     function getSearchQ($method, $value, $name=false) {
         $name = $name ?: $this->get('name');
-        $val = '"?'.implode('("|,|$)|"?', array_keys($value)).'("|,|$)';
+        $val = $value;
+        if ($value && is_array($value))
+            $val = '"?'.implode('("|,|$)|"?', array_keys($value)).'("|,|$)';
         switch ($method) {
         case '!includes':
             return Q::not(array("{$name}__regex" => $val));
-- 
GitLab