Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Major
-
Resolution: Fixed/Completed
-
Affects Version/s: 2.0
-
Fix Version/s: 2.1.2
-
Component/s: CiviContribute
-
Labels:None
Description
v2.0.3
On a contribution page, a value of 0 in the amount_other text box is correctly rejected and an error returned saying "Amount is required field.", but if 0.00 is entered the amount is incorrectly accepted by the form. The attached patch fixes the problem for v2.0.3.
Currently it simply checks if ( !$amount ), but 0.00 is being evaluated as a string. Casting it to a type of float, ( ! (float) $amount ), causes it to evaluate properly, and hence 0.00 to be correctly rejected.
From looking at Main.php in trunk, it seems that this is likely an issue for 2.1 as well, though I haven't marked it as such on this report.
We discovered this because a number of contributions showed up as "Completed" with an amount of $0.00. This could be a separate but related issue, but when the user is able to enter 0.00, when they click "Continue" on the confirmation page, rather than being directed to PayPal they are immediately returned to a Thank You page. It's could be that PayPal received the request, but rejected it and redirected the user back since the amount was invalid. Perhaps CiviCRM doesn't interpret this rejection/response correctly and erroneously marks a $0.00 contribution as Completed???