isset/required validation bug |
[eluser]mjijackson[/eluser]
This bug is discussed on this thread. In that thread, some users found a clever workaround for what is actually a bug in the code. When validation runs, it short-circuits any fields that have an 'isset' or 'required' rule if they are in fact not set. However, in the short-circuit, it neglects to set the error message for that field. This can be remedied with the following: Code: $error = $field . '_error'; It's keeping the code behavior consistent throughout the Validation class. The code should be changed around line 232 of Validation.php in order to squash the bug.
[eluser]Derek Allard[/eluser]
Thanks mjijackson. Could you post the full function that you are proposing?
[eluser]mathgl67[/eluser]
i have a litle patch for this issue. i don't know if it's fixing the whole problem. Code: diff -r 680e129277f9 -r 114fcf6410d5 system/libraries/Validation.php
[eluser]mjijackson[/eluser]
The full function is too large to post in this forum. Instead, I'll post the relevant portion. This is starting on line 206 of system/libraries/Validation.php: Code: /* The above post is also correct.
[eluser]mathgl67[/eluser]
I think the error variable should be set before building the error message. Else the error variable will be set with the text define in set_fields(). Code: // Set the error variable name. Example: $this->username_error
[eluser]mjijackson[/eluser]
The error message is supposed to contain the text defined in set fields. That's one of the reasons why that function exists. Look further down in the code and you'll see that the same thing happens a few lines further down.
|
Welcome Guest, Not a member yet? Register Sign In |