From 31fd7b1eda8b1f6fbf175af280108f3cf1dc6aa1 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Fri, 10 May 2013 20:17:40 -0400 Subject: [PATCH] CRM-12556 - Treat string "202" and number 202 the same ---------------------------------------- * CRM-12556: Assign api_key for a user via command-line http://issues.civicrm.org/jira/browse/CRM-12556 --- api/v3/utils.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/api/v3/utils.php b/api/v3/utils.php index c680e00b8e..8745b09c89 100644 --- a/api/v3/utils.php +++ b/api/v3/utils.php @@ -1472,10 +1472,10 @@ function _civicrm_api3_validate_integer(&$params, &$fieldName, &$fieldInfo, $ent //if fieldname exists in params if (CRM_Utils_Array::value($fieldname, $params)) { // if value = 'user_contact_id' (or similar), replace value with contact id - if (!is_integer($params[$fieldname])) { + if (!is_numeric($params[$fieldname])) { $realContactId = _civicrm_api3_resolve_contactID($params[$fieldname]); if (!is_numeric($realContactId)) { - throw new API_Exception("\"$fieldname\" cannot be resolved to a contact ID", 2002, array('error_field' => $fieldname,"type"=>"integer")); + throw new API_Exception("\"$fieldname\" \"{$params[$fieldname]}\" cannot be resolved to a contact ID", 2002, array('error_field' => $fieldname,"type"=>"integer")); } $params[$fieldname] = $realContactId; } @@ -1531,6 +1531,7 @@ function _civicrm_api3_resolve_contactID($contactIdExpr) { return $contactID; } + return NULL; } function _civicrm_api3_validate_html(&$params, &$fieldName, &$fieldInfo) { -- 2.25.1