Inexistant form_validation rule/callback silently passes TRUE - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Inexistant form_validation rule/callback silently passes TRUE (/showthread.php?tid=49546) |
Inexistant form_validation rule/callback silently passes TRUE - El Forum - 02-24-2012 [eluser]Pnux[/eluser] Take these rules as an example: Code: $config["user_name_last"] = with this code on the controller: Code: $this->load->library('form_validation'); If firstName is set to "hello world", the validation will return FALSE because its longer than 2 characters. But if firstName is set to "n", the validation will return TRUE. Same thing applies using Code: 'rules' => 'notARuleNamedLikeThis|max_length[2]' The thing is the validation goes through without a problem and no error is displayed/logged. I consider this a bug as, along the way, a programmer can change the declaration of the rule/callback and forget to change it on the validation rules, leaving that rule obsolete and unnoticed until an issue arise. In my opinion, this should be prevented whenever possible; but what do you think? Inexistant form_validation rule/callback silently passes TRUE - El Forum - 02-24-2012 [eluser]CroNiX[/eluser] Yes, this is a bug that has been fixed for the next release (or you can grab the code from Github) Inexistant form_validation rule/callback silently passes TRUE - El Forum - 02-26-2012 [eluser]Pnux[/eluser] Thanks a lot for the fast reply, i fixed the existent callback/rule by adding it to MY_Form_validation for the time being. We'll fix the rest (if they are broken) when the next release comes. |