Changed Validation::cc() so custom regex match will call Validation::_luhn()

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@3845 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
phpnut 2006-11-08 12:50:39 +00:00
parent 57ef07a04d
commit a046a338bb

View file

@ -183,7 +183,9 @@ class Validation extends Object {
} }
if(!is_null($this->regex)) { if(!is_null($this->regex)) {
return $this->_check(); if($this->_check()) {
return $this->_luhn();
}
} }
$cards = array('all' => array('amex' => '/^3[4|7]\\d{13}$/', $cards = array('all' => array('amex' => '/^3[4|7]\\d{13}$/',
@ -238,6 +240,9 @@ class Validation extends Object {
*/ */
function _luhn() { function _luhn() {
if($this->deep === true){ if($this->deep === true){
if($this->check == 0) {
return false;
}
$sum = 0; $sum = 0;
$length = strlen($this->check); $length = strlen($this->check);