diff options
author | Vincent Petry <vincent@nextcloud.com> | 2022-12-19 12:07:11 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-19 12:07:11 +0100 |
commit | 1aa4a0ec04cc481509c6266a01a8035c6199fad5 (patch) | |
tree | 11e8b5973b1bd5a4e1f7513af596c07f343d4b1f | |
parent | af246d6bd106af5d75aa106f85414a680f86b5f5 (diff) | |
parent | e8619feb1893a5ffd7fad662a1d8517a85bd10ed (diff) | |
download | nextcloud-server-1aa4a0ec04cc481509c6266a01a8035c6199fad5.tar.gz nextcloud-server-1aa4a0ec04cc481509c6266a01a8035c6199fad5.zip |
Merge pull request #35798 from nextcloud/backport/35780/stable25
[stable25] Fix missing cast of double controller parameters
-rw-r--r-- | lib/private/AppFramework/Http/Dispatcher.php | 2 | ||||
-rw-r--r-- | tests/lib/AppFramework/Http/DispatcherTest.php | 21 |
2 files changed, 15 insertions, 8 deletions
diff --git a/lib/private/AppFramework/Http/Dispatcher.php b/lib/private/AppFramework/Http/Dispatcher.php index c1a203a7165..aaaf2ba6560 100644 --- a/lib/private/AppFramework/Http/Dispatcher.php +++ b/lib/private/AppFramework/Http/Dispatcher.php @@ -194,7 +194,7 @@ class Dispatcher { $arguments = []; // valid types that will be casted - $types = ['int', 'integer', 'bool', 'boolean', 'float']; + $types = ['int', 'integer', 'bool', 'boolean', 'float', 'double']; foreach ($this->reflector->getParameters() as $param => $default) { diff --git a/tests/lib/AppFramework/Http/DispatcherTest.php b/tests/lib/AppFramework/Http/DispatcherTest.php index 8f591f26e58..016bd7efb58 100644 --- a/tests/lib/AppFramework/Http/DispatcherTest.php +++ b/tests/lib/AppFramework/Http/DispatcherTest.php @@ -51,11 +51,12 @@ class TestController extends Controller { /** * @param int $int * @param bool $bool + * @param double $foo * @param int $test - * @param int $test2 + * @param integer $test2 * @return array */ - public function exec($int, $bool, $test = 4, $test2 = 1) { + public function exec($int, $bool, $foo, $test = 4, $test2 = 1) { $this->registerResponder('text', function ($in) { return new JSONResponse(['text' => $in]); }); @@ -315,7 +316,8 @@ class DispatcherTest extends \Test\TestCase { [ 'post' => [ 'int' => '3', - 'bool' => 'false' + 'bool' => 'false', + 'double' => 1.2, ], 'method' => 'POST' ], @@ -346,6 +348,7 @@ class DispatcherTest extends \Test\TestCase { 'post' => [ 'int' => '3', 'bool' => 'false', + 'double' => 1.2, 'test2' => 7 ], 'method' => 'POST', @@ -377,7 +380,8 @@ class DispatcherTest extends \Test\TestCase { [ 'post' => [ 'int' => '3', - 'bool' => 'false' + 'bool' => 'false', + 'double' => 1.2, ], 'urlParams' => [ 'format' => 'text' @@ -410,7 +414,8 @@ class DispatcherTest extends \Test\TestCase { [ 'post' => [ 'int' => '3', - 'bool' => 'false' + 'bool' => 'false', + 'double' => 1.2, ], 'urlParams' => [ 'format' => 'json' @@ -443,7 +448,8 @@ class DispatcherTest extends \Test\TestCase { [ 'post' => [ 'int' => '3', - 'bool' => 'false' + 'bool' => 'false', + 'double' => 1.2, ], 'server' => [ 'HTTP_ACCEPT' => 'application/text, test', @@ -477,7 +483,8 @@ class DispatcherTest extends \Test\TestCase { [ 'post' => [ 'int' => '3', - 'bool' => 'false' + 'bool' => 'false', + 'double' => 1.2, ], 'get' => [ 'format' => 'text' |