Skip to content

Instantly share code, notes, and snippets.

@tonyhb
Created March 16, 2011 13:51
Show Gist options
  • Save tonyhb/872522 to your computer and use it in GitHub Desktop.
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.
public function action_index()
{
echo "<h1>Validation checking</h1>";
$data = array(
"contact_name" => "Name here",
"contact_email" => "admin@example.co.uk",
"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);
}
@tonyhb
Copy link
Author

tonyhb commented Mar 16, 2011

Expected validation to fail, but it returns TRUE.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment