Welcome Guest, Not a member yet? Register   Sign In
Is this a bug or a design decision?
#1

[eluser]RobertSF[/eluser]
Before version 2.2.0, the following code worked --
Code:
$this->form_validation->set_rules('login', 'Login', 'required | is_unique[users.login]');

Now it doesn't. What's the problem? The spaces surrounding the pipe symbol. For it to work in 2.2.0, it must be --
Code:
$this->form_validation->set_rules('login', 'Login', 'required|is_unique[users.login]');

Otherwise, the rules won't run and you'll get an error message in your log file. That's because Codeigniter isn't trimming the rules, so there's no valid rule called "required " and there's no valid rule called " is unique."

I consider it a bug. There's no good reason to prohibit white space.
#2

[eluser]CroNiX[/eluser]
This is the first I've ever seen anybody mention this. I don't consider it a bug since all of the documentation has always been consistent and shows NO spaces between rules. I'd say the bug is what you discovered (allowing spaces) and it was fixed as it's unnecessary. If you don't like it you can always extend the form_validation class and add trim() where you want it.
#3

[eluser]RobertSF[/eluser]
Well, ok, I hear ya. But still, you gotta admit that whitespace rarely turns into a problem in web development. The only situation I can think of is sending whitespace (or anything) before sending headers.

If development continues on Codeigniter, I hope the developers reconsider this issue.




Theme © iAndrew 2016 - Forum software by © MyBB