remove empty url query parameters

This commit is contained in:
Dennis Eichhorn 2020-10-24 23:32:24 +02:00
parent 5aa0276f11
commit 2bcf7b78a4

View File

@ -216,6 +216,12 @@ final class UriFactory
}
\parse_str($urlStructure['query'], $urlStructure['query']);
foreach ($urlStructure['query'] as $para => $query) {
if ($query === '' && \stripos($url, $para . '=') !== false) {
unset($urlStructure['query'][$para]);
}
}
}
$escaped =
@ -268,10 +274,14 @@ final class UriFactory
return $uri;
}
if (\stripos($uri, '{?u')) {
$a = 1;
}
$parsed = \preg_replace_callback('(\{[\/#\?%@\.\$][a-zA-Z0-9\-]*\})', function ($match) use ($toMatch) {
$match = \substr($match[0], 1, \strlen($match[0]) - 2);
return $toMatch[$match] ?? self::$uri[$match] ?? $match;
return $toMatch[$match] ?? self::$uri[$match] ?? '';
}, $uri);
return self::unique($parsed ?? '');