CRM-18457: Error on report form strlen() expects parameter 1 to be string
authordeb.monish <monish.deb@webaccessglobal.com>
Tue, 26 Apr 2016 11:53:58 +0000 (17:23 +0530)
committerdeb.monish <monish.deb@webaccessglobal.com>
Wed, 27 Apr 2016 07:12:00 +0000 (12:42 +0530)
CRM/Report/Form.php

index f720104a49f8ca0514f41a6b132330cd897085cc..6e07ea7b069f723ae014db4d99e7726d8340a449 100644 (file)
@@ -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) {