diff --git a/CHANGELOG.md b/CHANGELOG.md index cdf36c75..72fa8244 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com), and this ### Added * [#1015](https://github.com/shlinkio/shlink/issues/1015) Shlink now accepts configuration via env vars even when not using docker. - The config generated with the installing tool still has precedence over the env vars, so it cannot be combined. Either you use the tool, or use env vars. + The config generated with the installing tool still has precedence over the env vars, so it cannot be combined. Either you use the tool, or use env vars. ### Changed * [#1142](https://github.com/shlinkio/shlink/issues/1142) Replaced `doctrine/cache` package with `symfony/cache`. @@ -23,6 +23,23 @@ The format is based on [Keep a Changelog](https://keepachangelog.com), and this * *Nothing* +## [2.8.1] - 2021-08-15 +### Added +* *Nothing* + +### Changed +* *Nothing* + +### Deprecated +* *Nothing* + +### Removed +* *Nothing* + +### Fixed +* [#1155](https://github.com/shlinkio/shlink/issues/1155) Fixed numeric query params in long URLs being replaced by `0`. + + ## [2.8.0] - 2021-08-04 ### Added * [#1089](https://github.com/shlinkio/shlink/issues/1089) Added new `ENABLE_PERIODIC_VISIT_LOCATE` env var to docker image which schedules the `visit:locate` command every hour when provided with value `true`. diff --git a/module/Core/src/ShortUrl/Helper/ShortUrlRedirectionBuilder.php b/module/Core/src/ShortUrl/Helper/ShortUrlRedirectionBuilder.php index 43ea4993..f83a7eb9 100644 --- a/module/Core/src/ShortUrl/Helper/ShortUrlRedirectionBuilder.php +++ b/module/Core/src/ShortUrl/Helper/ShortUrlRedirectionBuilder.php @@ -5,11 +5,11 @@ declare(strict_types=1); namespace Shlinkio\Shlink\Core\ShortUrl\Helper; use GuzzleHttp\Psr7\Query; +use Laminas\Stdlib\ArrayUtils; use League\Uri\Uri; use Shlinkio\Shlink\Core\Entity\ShortUrl; use Shlinkio\Shlink\Core\Options\TrackingOptions; -use function array_merge; use function sprintf; class ShortUrlRedirectionBuilder implements ShortUrlRedirectionBuilderInterface @@ -37,7 +37,8 @@ class ShortUrlRedirectionBuilder implements ShortUrlRedirectionBuilderInterface unset($currentQuery[$disableTrackParam]); } - $mergedQuery = array_merge($hardcodedQuery, $currentQuery); + // We want to merge preserving numeric keys, as some params might be numbers + $mergedQuery = ArrayUtils::merge($hardcodedQuery, $currentQuery, true); return empty($mergedQuery) ? null : Query::build($mergedQuery); } diff --git a/module/Core/test/ShortUrl/Helper/ShortUrlRedirectionBuilderTest.php b/module/Core/test/ShortUrl/Helper/ShortUrlRedirectionBuilderTest.php index c64147c1..985a3cea 100644 --- a/module/Core/test/ShortUrl/Helper/ShortUrlRedirectionBuilderTest.php +++ b/module/Core/test/ShortUrl/Helper/ShortUrlRedirectionBuilderTest.php @@ -37,6 +37,8 @@ class ShortUrlRedirectionBuilderTest extends TestCase yield ['https://domain.com/foo/bar?some=thing', [], null]; yield ['https://domain.com/foo/bar?some=thing&else', ['else' => null], null]; yield ['https://domain.com/foo/bar?some=thing&foo=bar', ['foo' => 'bar'], null]; + yield ['https://domain.com/foo/bar?some=thing&123=foo', ['123' => 'foo'], null]; + yield ['https://domain.com/foo/bar?some=thing&456=foo', [456 => 'foo'], null]; yield ['https://domain.com/foo/bar?some=overwritten&foo=bar', ['foo' => 'bar', 'some' => 'overwritten'], null]; yield ['https://domain.com/foo/bar?some=overwritten', ['foobar' => 'notrack', 'some' => 'overwritten'], null]; yield ['https://domain.com/foo/bar/something/else-baz?some=thing', [], '/something/else-baz'];