Correcting Validation::blank() implementation

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@3837 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
phpnut 2006-11-08 01:56:07 +00:00
parent d2ffbe2016
commit 803bf4d0e4

View file

@ -127,20 +127,27 @@ class Validation extends Object {
} }
/** /**
* Returns false if field is left blank -OR- only whitespace characters are present in it's value * Returns false if field is left blank -OR- only whitespace characters are present in it's value
* Whitespace characters include Space, Tab, Carriage Return, Newline, Formfeed * Whitespace characters include Space, Tab, Carriage Return, Newline
* *
* @param array or string $check * $check can be passed as an array:
* array('check' => 'valueToCheck');
*
* @param mixed $check
* @return boolean * @return boolean
*/ */
function blank($check) { function blank($check) {
if (is_array($check)) { if (is_array($check)) {
$this->_extract($check); $this->_extract($check);
$this->regex = '/\\S*/';
} else { } else {
$this->check = $check; $this->check = $check;
$this->regex = '/\\S*/';
} }
return $this->_check();
$this->regex = '/[^\\s]/';
if($this->_check() === true){
return false;
} else {
return true;
}
} }
function cc($check, $regex = null, $type = 'fast') { function cc($check, $regex = null, $type = 'fast') {