From a046a338bb9afaf0871058a7606f8b6afab358ac Mon Sep 17 00:00:00 2001 From: phpnut Date: Wed, 8 Nov 2006 12:50:39 +0000 Subject: [PATCH] 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 --- cake/libs/validation.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cake/libs/validation.php b/cake/libs/validation.php index 68bed7781..63cbfc179 100644 --- a/cake/libs/validation.php +++ b/cake/libs/validation.php @@ -183,7 +183,9 @@ class Validation extends Object { } if(!is_null($this->regex)) { - return $this->_check(); + if($this->_check()) { + return $this->_luhn(); + } } $cards = array('all' => array('amex' => '/^3[4|7]\\d{13}$/', @@ -238,6 +240,9 @@ class Validation extends Object { */ function _luhn() { if($this->deep === true){ + if($this->check == 0) { + return false; + } $sum = 0; $length = strlen($this->check);