From 55a5250b142f8ba7459b1a2fe12fd836f645e5dc Mon Sep 17 00:00:00 2001 From: "deb.monish" Date: Tue, 26 Apr 2016 17:23:58 +0530 Subject: [PATCH] CRM-18457: Error on report form strlen() expects parameter 1 to be string --- CRM/Report/Form.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/CRM/Report/Form.php b/CRM/Report/Form.php index f720104a49..6e07ea7b06 100644 --- a/CRM/Report/Form.php +++ b/CRM/Report/Form.php @@ -1890,14 +1890,22 @@ class CRM_Report_Form extends CRM_Core_Form { $clause = "( {$field['dbAlias']} $sqlOP )"; break; + case 'eq': + case 'neq': + case 'ne': + //CRM-18457: some custom field passes value in array format against binary operator + if (is_array($value) && count($value)) { + $value = $value[0]; + } + default: - if ($value !== NULL && strlen($value) > 0) { + if ($value !== NULL && $value !== '') { if (isset($field['clause'])) { // FIXME: we not doing escape here. Better solution is to use two // different types - data-type and filter-type $clause = $field['clause']; } - else { + elseif (!is_array($value)) { $value = CRM_Utils_Type::escape($value, $type); $sqlOP = $this->getSQLOperator($op); if ($field['type'] == CRM_Utils_Type::T_STRING) { -- 2.25.1