Hey no big deal here but if $exp_month is 0 or >12, there is no validation preventing this from passing.
Reference commerce_payment_credit_card_validate() i

Comments

rszrama’s picture

Title: Commerce Payment form validates when $exp_month is out of bounds » Support CC start date / expiration date validation for non-select list data entry
Category: bug » feature
Status: Active » Fixed

I don't really think it matters, since the Forms API is already validating CC input against allowed options from the form. I suppose someone could create their own CC form using textfields instead of select lists and then use these validation functions... but I doubt it would happen. : P

But in the interest of making them flexible, why not. I've added month validation so the start date and expiration date validation functions can be used to validate data that comes from other sources than the normal CC form. It will fail for the month if a value less than 1 or greater than 12 is given.

Commit: http://drupalcode.org/project/commerce.git/commitdiff/ff39e56

rszrama’s picture

I don't really think it matters, since the Forms API is already validating CC input against allowed options from the form. I suppose someone could create their own CC form using textfields instead of select lists and then use these validation functions... but I doubt it would happen. : P

But in the interest of making them flexible, why not. I've added month validation so the start date and expiration date validation functions can be used to validate data that comes from other sources than the normal CC form. It will fail for the month if a value less than 1 or greater than 12 is given.

Commit: http://drupalcode.org/project/commerce.git/commitdiff/ff39e56

blasthaus’s picture

Thanks as I said no biggie, I was indeed using just the validation functions for a credit card billing-update form which was initially built as a text inputs and just happened to noticed that. The validations are awesome btw, great work as always!

rszrama’s picture

Rockin'. It wasn't hard to put it in. ; )

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.