[HttpFoundation] Avoid a few unnecessary str_replace() calls
[HttpKernel] Avoid updating the context if the request did not change

Due to the BC $this->setRequest() call in the onKernelRequest method, the
request is set twice every time in Symfony, and RequestContext::fromRequest
takes 1ms to run here so if we can skip one call it is a win.