-
-
Notifications
You must be signed in to change notification settings - Fork 116
Fix Presenter::argsToParams to not remove false #107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
👍 |
src/Application/UI/Presenter.php
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think, is_scalar($args[$name]) && !is_bool($args[$name]) && (string) $args[$name] === '' can be simplified to $args[$name] === '' :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably. Integers and floats should never become an empty string after type casting.
|
@dg Thanks! |
|
thanks to you ;) |
|
The question is whether to include it in v2.3… |
|
It admitedly is a BC break so as much as I'd like it in stable 2.x, putting it in 2.3 is probably not a best idea. Are there other commits like this? If so we might want to release nette/application 2.4. |
|
I did not realize that it is a BC break, so it will be in 2.4. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just wondering, why did you remove is_scalar here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because as far as I can tell is_scalar($args[$name]) && (string) $args[$name] === '' is equivalent to $args[$name] === '' || $args[$name] === false.
|
Well since it required a change in tests and generates different URLs in some cases I would consider it a BC break... |
…L and FALSE [Closes #107] # Conflicts: # tests/UI/Presenter.link().php7.phpt
I sometimes use boolean parameters in presenters and I want the
param=0part in the URL becauseFALSEandNULLare totally different values for me. Right now however argsToParams replaces false values with nulls which breaks my use case.