mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
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:
parent
d2ffbe2016
commit
803bf4d0e4
1 changed files with 12 additions and 5 deletions
|
@ -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
|
||||
* 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
|
||||
*/
|
||||
function blank($check) {
|
||||
if (is_array($check)) {
|
||||
$this->_extract($check);
|
||||
$this->regex = '/\\S*/';
|
||||
} else {
|
||||
$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') {
|
||||
|
|
Loading…
Add table
Reference in a new issue