Closed
Description
There are several inconsistent method names and I think the class can be better designed.
- Synchronization of setters, getters, and parameter bags (server etc.) is unclear and inconsistent. For example there is a
setMethod
method which also modifies the ServerBag but there is nosetPath
. So either a Request should be immutable or mutable. But we have a mix of it. Furthermore, some getters a cached likegetPathInfo
and some are not likegetHost
. So when modifying the public parameter bags, sometimes it has influence on the Request getters and sometimes not. See also [HttpFoundation] Request::getPathInfo() inconsistencies #10478 getUriForPath
is wrong. The correct name according to the current behavior would begetUriForPathInfo
- the names for
getBaseUrl
andgetBasePath
are both unfortunate because the only difference is the inclusion of the script file name and has nothing to do with URL vs path.
The method name for Request::getPathInfo()
is so bad because
- it returns the path of a URI and not a "path info" (there is no such thing in the URI spec)
- it suggest to return "more info" in form of an array like the php function pathinfo does, but it only returns the plain path
So the name is really confusing as it does not behave similar to phps pathinfo() and is also semantically wrong.
I suggest to deprecategetPathInfo()
and introducegetPath()
.
Working with it bothered me ever since. And I think we should fix that now before it's too late.
Changing some names like baseUrl
(that also does not exist in CGI terms) will need to be reflected in the routing component as well.