treat fragment after resolving query string params
This commit is contained in:
parent
6f05632bc2
commit
7475aa8a48
|
@ -257,18 +257,15 @@ class UrlGenerator implements UrlGeneratorInterface, ConfigurableRequirementsInt
|
|||
$url = $schemeAuthority.$this->context->getBaseUrl().$url;
|
||||
}
|
||||
|
||||
// extract unused parameters
|
||||
$extra = array_diff_key($parameters, $variables, $defaults);
|
||||
|
||||
// extract fragment
|
||||
$fragment = isset($extra['_fragment']) ? $extra['_fragment'] : '';
|
||||
unset($extra['_fragment']);
|
||||
|
||||
// add a query string if needed
|
||||
$extra = array_udiff_assoc(array_diff_key($parameters, $variables), $defaults, function ($a, $b) {
|
||||
return $a == $b ? 0 : 1;
|
||||
});
|
||||
|
||||
// extract fragment
|
||||
$fragment = isset($extra['_fragment']) ? $extra['_fragment'] : '';
|
||||
unset($extra['_fragment']);
|
||||
|
||||
if ($extra && $query = http_build_query($extra, '', '&')) {
|
||||
// "/" and "?" can be left decoded for better user experience, see
|
||||
// http://tools.ietf.org/html/rfc3986#section-3.4
|
||||
|
|
Reference in New Issue