aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJoas Schilling <213943+nickvergessen@users.noreply.github.com>2024-11-28 14:46:16 +0100
committerGitHub <noreply@github.com>2024-11-28 14:46:16 +0100
commitdd101dd0f70fc740106c6db30b0742e4db772b08 (patch)
tree5e1f3b211866bc3187d2c844dafd150f6ef83a9d /lib
parent379f575c25cdf4769d5c019394e73ac8b8f46385 (diff)
parent2b6da9eaeee33e7cbfc88960d7686d8d8b844bbd (diff)
downloadnextcloud-server-dd101dd0f70fc740106c6db30b0742e4db772b08.tar.gz
nextcloud-server-dd101dd0f70fc740106c6db30b0742e4db772b08.zip
Merge pull request #49515 from nextcloud/bugfix/noid/boolean-false-in-multipart-form-data
fix(controller): Fix false booleans in multipart/form-data
Diffstat (limited to 'lib')
-rw-r--r--lib/private/AppFramework/Http/Dispatcher.php12
1 files changed, 2 insertions, 10 deletions
diff --git a/lib/private/AppFramework/Http/Dispatcher.php b/lib/private/AppFramework/Http/Dispatcher.php
index e2750e30fa9..d63a9108b47 100644
--- a/lib/private/AppFramework/Http/Dispatcher.php
+++ b/lib/private/AppFramework/Http/Dispatcher.php
@@ -183,16 +183,8 @@ class Dispatcher {
$value = $this->request->getParam($param, $default);
$type = $this->reflector->getType($param);
- // if this is submitted using GET or a POST form, 'false' should be
- // converted to false
- if (($type === 'bool' || $type === 'boolean') &&
- $value === 'false' &&
- (
- $this->request->method === 'GET' ||
- str_contains($this->request->getHeader('Content-Type'),
- 'application/x-www-form-urlencoded')
- )
- ) {
+ // Converted the string `'false'` to false when the controller wants a boolean
+ if ($value === 'false' && ($type === 'bool' || $type === 'boolean')) {
$value = false;
} elseif ($value !== null && \in_array($type, $types, true)) {
settype($value, $type);