Use strict type checking in in_array
authorColeman Watts <coleman@civicrm.org>
Mon, 6 Mar 2017 21:02:46 +0000 (16:02 -0500)
committerColeman Watts <coleman@civicrm.org>
Tue, 14 Mar 2017 01:20:39 +0000 (21:20 -0400)
This php function has a bug where it incorrectly returns true if the first param is 0.

Civi/API/Api3SelectQuery.php

index 77bdd1b4b79c51732a395277d8258e74d4022963..1585b152b12d88e2ea28771a293180c1a5e2c1d7 100644 (file)
@@ -106,7 +106,7 @@ class Api3SelectQuery extends SelectQuery {
         continue;
       }
       $operator = is_array($value) ? \CRM_Utils_Array::first(array_keys($value)) : NULL;
-      if (!in_array($operator, \CRM_Core_DAO::acceptedSQLOperators())) {
+      if (!in_array($operator, \CRM_Core_DAO::acceptedSQLOperators(), TRUE)) {
         $value = array('=' => $value);
       }
       $filters[$key] = \CRM_Core_DAO::createSQLFilter("{$table_name}.{$column_name}", $value);