From 638e889750decf9498e1da9b0cb7701db8bfd7f5 Mon Sep 17 00:00:00 2001 From: Kenny Johansson Date: Thu, 12 Jun 2025 12:56:12 +0200 Subject: [PATCH] Allow curly brackets within query/fragment --- src/Uri.php | 2 +- tests/UriMergeTest.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Uri.php b/src/Uri.php index f5edf41..9828a4c 100644 --- a/src/Uri.php +++ b/src/Uri.php @@ -35,7 +35,7 @@ class Uri protected const PATH_REGEX = '`^(?:(?:%[a-f0-9]{2})+|[a-z0-9-._~!$&\'()*+,;=:@/]+)*$`i'; - protected const QUERY_OR_FRAGMENT_REGEX = '`^(?:(?:%[a-f0-9]{2})+|[a-z0-9-._~!$&\'"()\[\]*+,;=:@?/%]+)*$`i'; + protected const QUERY_OR_FRAGMENT_REGEX = '`^(?:(?:%[a-f0-9]{2})+|[a-z0-9-._~!$&\'"()\[\]*+,;=:@?/%{}]+)*$`i'; protected array $components; diff --git a/tests/UriMergeTest.php b/tests/UriMergeTest.php index 7f331a0..036a80e 100644 --- a/tests/UriMergeTest.php +++ b/tests/UriMergeTest.php @@ -45,6 +45,7 @@ public function uriProvider() ["//g", "http://g"], ["?y", "http://a/b/c/d;p?y"], ["g?y", "http://a/b/c/g?y"], + ["g?y={y}", "http://a/b/c/g?y={y}"], ["#s", "http://a/b/c/d;p?q#s"], ["g#s", "http://a/b/c/g#s"], ["g?y#s", "http://a/b/c/g?y#s"],