symfony/symfony — pull request #11499 by pkruithof (2014-07-28 14:50:22+00:00)
Title: [BrowserKit] Fixed relative redirects for ambiguous paths

| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |

This fixes a problem I discovered today during Mink testing: I have a route with a slug and id, separated by colon (`/{slug}:{id}`). When the `HTTP_HOST` is being normalized it only checks for array key existence, not emptyness. In this case it was `false` due to the `parse_url` call in `updateServerFromUri`, which cannot handle this case:

```
$> php -r "var_dump(parse_url('/redirect', PHP_URL_HOST));" NULL

$> php -r "var_dump(parse_url('/redirect:1234', PHP_URL_HOST));" bool(false)
```

So now the url becomes `http:///redirect:1234`, because of the missing host.