From 803bf4d0e40dfe14995bc86fc394ab5351f42571 Mon Sep 17 00:00:00 2001 From: phpnut Date: Wed, 8 Nov 2006 01:56:07 +0000 Subject: [PATCH] Correcting Validation::blank() implementation git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@3837 3807eeeb-6ff5-0310-8944-8be069107fe0 --- cake/libs/validation.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/cake/libs/validation.php b/cake/libs/validation.php index a5d7cb915..af2013620 100644 --- a/cake/libs/validation.php +++ b/cake/libs/validation.php @@ -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') {