You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
bug #25491 [Routing] Use the default host even if context is empty (sroze)
This PR was merged into the 2.7 branch.
Discussion
----------
[Routing] Use the default host even if context is empty
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #25464
| License | MIT
| Doc PR | ø
When the host in the context is empty... we should still use the default host.
**Note:** it seems like a lot of changes but all I did was to remove the `if` and de-indent the code that was inside.
Commits
-------
8f357df Use the default host even if context is empty and fallback to relative URL if empty host
// We do this for BC; to be removed if _scheme is not supported anymore
194
+
$referenceType = self::ABSOLUTE_URL;
195
+
$scheme = $req;
196
+
}
197
197
198
-
if ($hostTokens) {
199
-
$routeHost = '';
200
-
foreach ($hostTokensas$token) {
201
-
if ('variable' === $token[0]) {
202
-
if (null !== $this->strictRequirements && !preg_match('#^'.$token[2].'$#i', $mergedParams[$token[3]])) {
203
-
$message = sprintf('Parameter "%s" for route "%s" must match "%s" ("%s" given) to generate a corresponding URL.', $token[3], $name, $token[2], $mergedParams[$token[3]]);
204
-
205
-
if ($this->strictRequirements) {
206
-
thrownewInvalidParameterException($message);
207
-
}
198
+
if ($hostTokens) {
199
+
$routeHost = '';
200
+
foreach ($hostTokensas$token) {
201
+
if ('variable' === $token[0]) {
202
+
if (null !== $this->strictRequirements && !preg_match('#^'.$token[2].'$#i', $mergedParams[$token[3]])) {
203
+
$message = sprintf('Parameter "%s" for route "%s" must match "%s" ("%s" given) to generate a corresponding URL.', $token[3], $name, $token[2], $mergedParams[$token[3]]);
0 commit comments