BUG notice level error when value is not set on CreditCardField

This commit is contained in:
Will Rossiter 2015-01-31 11:15:52 +13:00
parent 9944e82e51
commit e724d6f578

View File

@ -59,10 +59,12 @@ class CreditCardField extends TextField {
}
public function validate(Validator $validator){
// If the field is empty then don't return an invalidation message
if(!trim(implode("", $this->value))) return true;
if(!$this->value || !trim(implode("", $this->value))) {
return true;
}
$i=0;
if($this->value) foreach($this->value as $part){
if(!$part || !(strlen($part) == 4) || !preg_match("/([0-9]{4})/", $part)){
switch($i){