From 1909b981a4b3db83edfcd76fb4b6730a0cc8da81 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 27 Nov 2024 09:26:26 +0100 Subject: fix(controller): Fix false booleans in multipart/form-data Signed-off-by: Joas Schilling --- lib/private/AppFramework/Http/Dispatcher.php | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'lib/private/AppFramework/Http') 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); -- cgit v1.2.3