diff --git a/CHANGELOG.md b/CHANGELOG.md index 529b793..293b0ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Garbage collector config options, improve default garbage collection in session module +### 🐞 Fixed + +- Fix URL construction in Router module for URLs with ports + fragments + --- ## [3.5] - 18 August 2024 diff --git a/src/Vivid/Router/Router.php b/src/Vivid/Router/Router.php index a24c8f1..cbf3d61 100644 --- a/src/Vivid/Router/Router.php +++ b/src/Vivid/Router/Router.php @@ -471,10 +471,10 @@ public function constructUrl(string $url, array $params): string return (isset($urlComponents['scheme']) ? $urlComponents['scheme'] . '://' : '') . (isset($urlComponents['user']) ? $urlComponents['user'] . (isset($urlComponents['pass']) ? ':' . $urlComponents['pass'] : '') . '@' : '') . ($urlComponents['host'] ?? '') - . ($urlComponents['port'] ?? '') + . (isset($urlComponents['port']) ? ':' . $urlComponents['port'] : '') . ($urlComponents['path'] ?? '') . '?' . $urlComponents['query'] - . ($urlComponents['fragment'] ?? ''); + . (isset($urlComponents['fragment']) ? '#' . $urlComponents['fragment'] : ''); } } \ No newline at end of file