From: deb.monish Date: Tue, 26 Apr 2016 11:53:58 +0000 (+0530) Subject: CRM-18457: Error on report form strlen() expects parameter 1 to be string X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=55a5250b142f8ba7459b1a2fe12fd836f645e5dc;p=civicrm-core.git CRM-18457: Error on report form strlen() expects parameter 1 to be string --- 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) {