Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Trivial
-
Resolution: Fixed/Completed
-
Affects Version/s: 3.4.1
-
Fix Version/s: 3.4.2
-
Component/s: CiviCRM API
-
Labels:None
Description
When creating an OptionValue via. API v3, a the weight attribute must be specified in order to pass the mandatory fields check. This is correct, as defined in the DAO.
However, the mandatory_fields check uses empty() to evaluate each field in turn. In the case of weight, '0' is valid. However, PHP classes 0 as an empty value.
In such a circumstance, 0 is actually correct and has a semantic meaning.
Proposed patch for this bug is attached. However, I am unsure whether this is sufficient enough to allow robust validation.