Fixed issue introduced with league/uri library

This commit is contained in:
Alejandro Celaya 2020-07-10 23:25:31 +02:00
parent 36c12a69b1
commit 1401dd9156

View file

@ -68,13 +68,13 @@ abstract class AbstractTrackingAction implements MiddlewareInterface, RequestMet
private function buildUrlToRedirectTo(ShortUrl $shortUrl, array $currentQuery, ?string $disableTrackParam): string
{
$uri = Uri::createFromString($shortUrl->getLongUrl());
$hardcodedQuery = parse_query($uri->getQuery());
$hardcodedQuery = parse_query($uri->getQuery() ?? '');
if ($disableTrackParam !== null) {
unset($currentQuery[$disableTrackParam]);
}
$mergedQuery = array_merge($hardcodedQuery, $currentQuery);
return (string) $uri->withQuery(build_query($mergedQuery));
return (string) (empty($mergedQuery) ? $uri : $uri->withQuery(build_query($mergedQuery)));
}
private function shouldTrackRequest(ServerRequestInterface $request, array $query, ?string $disableTrackParam): bool