-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
fix(controller): Fix false booleans in multipart/form-data #49515
fix(controller): Fix false booleans in multipart/form-data #49515
Conversation
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.
What about query parameters? There we currently only allow 0/1 for booleans and openapi-extractor has a quirk to workaround this, but it would be great if we could send proper boolean true/false
That is already working properly with the <?php
$value = '0';
settype($value, 'bool');
var_dump($value);
// bool(false)
$value = 'false';
settype($value, 'bool');
var_dump($value);
// bool(true) In alignment via chat, I will make it match in all cases when the value is |
Signed-off-by: Joas Schilling <[email protected]>
e2318f2
to
1909b98
Compare
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.
That is already working properly with the settype path:
Hm ok then I have to check again 🤔
Signed-off-by: Joas Schilling <[email protected]>
Summary
I was debugging an issue reported by our frontenders with a new API (ref nextcloud/spreed#13871 (comment))
Turns out sending the boolean false in a post request sees it as
"false"
and therefore evaluates totrue
.We have some code in place to "sometimes" translate that to
false
(see diff). I now need to extend this tomultipart/form-data
.But at the same time I wonder why the check is there at all? When the controller requests a
boolean
, shouldn't we always convert"false"
tofalse
independent from request type?Checklist