Created
March 16, 2011 13:51
-
-
Save tonyhb/872522 to your computer and use it in GitHub Desktop.
When you validate an empty string with the rules not_empty and min_length, validation passes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function action_index() | |
{ | |
echo "<h1>Validation checking</h1>"; | |
$data = array( | |
"contact_name" => "Name here", | |
"contact_email" => "[email protected]", | |
"company_name" => "Newco Inc", | |
"password" => "", | |
"site_name" => "Newco Inc", | |
"site_address" => "newco", | |
"domain_name" => "", | |
"agree" => "agree", | |
); | |
$v = Validation::factory($data); | |
$v->rules( | |
'contact_email', array( | |
array('Valid::email'), | |
array('Valid::min_length', array(':value', 8)), | |
) | |
); | |
$v->rules('password', array( | |
array('Valid::not_empty'), | |
array('Valid::min_length', array(':value', 5)) | |
)); | |
echo Debug::vars($v->check()); | |
echo Debug::vars($data); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Expected validation to fail, but it returns
TRUE
.