Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Trivial
-
Resolution: Fixed/Completed
-
Affects Version/s: 4.6, 4.7.24
-
Fix Version/s: 4.7.27
-
Component/s: CiviContribute
-
Labels:
-
Versioning Impact:Patch (backwards-compatible bug fixes)
-
Documentation Required?:None
-
Funding Source:Contributed Code
-
Verified?:No
-
Overview:CiviContribute does not properly check the correct Contribution record was fetched in the completetransaction API call.
Description
In the API completetransaction function (line reference) we have this code:
if (!$contribution->id == $params['id'])
which is supposed to test that the id property of the $contribution object is equal to the id in the $params array.
However this will be evaluated by first applying the logical not ! to the contribution.id value, then comparing that with the params.id value.
(!null == 123) # TRUE - desired behaviour
(!123 == 123) # FALSE - desired behaviour
(!567 == 123) # FALSE - problem behaviour
This appears to have been written a long long time ago and I doubt it's caused any problems because the API will either return the right record or none, but it ain't right. It's done better in the repeatransaction code:
if (!$contribution->find(TRUE)) {