Affects Version/s: 1.8.4, 1.9
Environment:All (but specifically PHP 4.4.4), code fragment also fails under Windows Vista/Apache 2/PHP 5.2.5
In the Authorize enrol plug-in when a credit card expiry date (year) is entered, a validate error is generated blocking credit card usage. This applies to 1.8.4 and 1.8.4+. This is caused because validation() and also enrol.php expectes the field ccexpireyyyy to be of the form yyyy, actually the current code generates a single digit starting from 0,1,2...
The fix in enrol/authorize/enrol_form.php is as follows...
// $yearsmenu = array('' => get_string('choose')) + range($nowdate["year"] - 1, $nowdate["year"] + 15);
// Above line replaced by ALAN with following 5 lines
$yearsmenu = array('' => get_string('choose'));
$nowyear = $nowdate["year"] - 1;
for ($i = $nowyear; $i <= $nowyear + 16; $i++)
This more or less reverts the code to the way it was in a previous version (1.8.3+).
The index value that is returned by HTML form submission has to be a year value and not 0,1,2 etc. (e.g. $nowyear['2007'] = '2007', NOT $nowyear = '2007').
URL describing bug attached.
Fixed file attached (enrol/authorize/enrol_form.php [line 59]).