From c9215b0182a00e3741cad675fa1478b8fa25d527 Mon Sep 17 00:00:00 2001 From: Gregor Kralik Date: Fri, 11 Dec 2020 12:02:26 +0100 Subject: [PATCH] cast to string when calling rawurlencode() within Wildcard router Signed-off-by: Gregor Kralik --- src/Http/Wildcard.php | 2 +- test/Http/WildcardTest.php | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Http/Wildcard.php b/src/Http/Wildcard.php index 7c7856da..c93ed399 100644 --- a/src/Http/Wildcard.php +++ b/src/Http/Wildcard.php @@ -175,7 +175,7 @@ public function assemble(array $params = [], array $options = []) continue; } - $elements[] = rawurlencode($key) . $this->keyValueDelimiter . rawurlencode($value); + $elements[] = rawurlencode($key) . $this->keyValueDelimiter . rawurlencode((string) $value); $this->assembledParams[] = $key; } diff --git a/test/Http/WildcardTest.php b/test/Http/WildcardTest.php index 1e7bbcdf..c3c0c93d 100644 --- a/test/Http/WildcardTest.php +++ b/test/Http/WildcardTest.php @@ -83,6 +83,12 @@ public static function routeProvider() null, ['foo' => 'foo bar'] ], + 'params-contain-non-string-scalar-values' => [ + new Wildcard(), + '/int_param/42/float_param/4.2', + null, + ['int_param' => 42, 'float_param' => 4.2] + ], ]; }