Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Minor
-
Resolution: Fixed/Completed
-
Affects Version/s: 4.7.12
-
Fix Version/s: 4.7.14
-
Component/s: None
-
Labels:
-
Documentation Required?:None
-
Funding Source:Core Team Funds
Description
{{
$result = civicrm_api3('Grant', 'create', array(
'status_id'=>0,
'contact_id' => 1,
'grant_type_id'=>1,
'amount_total'=>100
));
}}
does not result in an API exception even though 0 is not a valid status_id for the Grant API.
The reason is that 0 evaluates to empty at https://github.com/civicrm/civicrm-core/blob/master/api/v3/utils.php#L2175 and hence _civicrm_api3_api_match_pseudoconstant is never called.
I think that working out how to ensure that they are checked is a job for someone that understands the API code better than me (though I'm happy to be mentored on that if you disagree
See https://github.com/civicrm/civicrm-core/pull/9296 for some details of how this was uncovered.