You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm consuming "pseudo-boolean" values from the query string, which if not handled carefully runs into issues because "false" evaluates to true, so I have to do something like this:
// default to true if param not provided, run condition if falseif (in_array($request->query->get('param', 1), ['false', 0])) {
...
}
...and casting to boolean doesn't work for avoiding the above.
If anyone else has this issue/is interested in a fix, I'll build out and PR getBoolean() (getBool()?) so that instead we've got:
if (false === $request->query->getBoolean('param', true)) {
...
}
or
if (!$request->query->getBoolean('param', true)) {
...
}
with a default of false of the second argument isn't provided.
Anyone interested?
The text was updated successfully, but these errors were encountered:
I discussed this with @iansltx in person. I was originally against, but I can now see the benefits here. I will put up an experimental branch for this issue with getBool(), getInt(), and getFloat() implemented.
I'm consuming "pseudo-boolean" values from the query string, which if not handled carefully runs into issues because
"false"evaluates totrue, so I have to do something like this:...and casting to boolean doesn't work for avoiding the above.
If anyone else has this issue/is interested in a fix, I'll build out and PR getBoolean() (getBool()?) so that instead we've got:
or
with a default of
falseof the second argument isn't provided.Anyone interested?
The text was updated successfully, but these errors were encountered: