Re: RFC: Server-Side Request and Response Objects (v2)
| From: | Michał Brzuchalski | Date: | Mon, 10 Feb 2020 16:46:43 +0000 |
| Subject: | Re: RFC: Server-Side Request and Response Objects (v2) | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-108437@lists.php.net to get a copy of this message | ||
Hi Paul,
thanks for bringing it back. Got some questions:
1. In your RFC $_ENV is bound to $request.
Looking at HttpFoundation can see it's build from $_GET, $_POST, $_FILES,
$_COOKIE, $_SESSION
and then looking at PSR ServerSideRequest it's build from $_COOKIE, $_GET,
$_POST, $_FILES, $_SERVER
but none of them bounds $_ENV.
Server environment variables basically don't change over time when server
process runs.
What is the specific use case that requires them to be coupled with
$request instance?
2. In your RFC all headers are mapped to $request properties
This behaviour is unclear and unusual to me, for eg. in summary can see
that if
server request has "Header-Name" it is found in
$_SERVER["HTTP_HEADER_NAME"] and
that one is bound to $request->headers["header-name"], ok but the next line
with example for
"Content-Type" shows that it's bound to $request->contentType - which means
probably that it can
be accessed in $request->headers["content-type"] as well, right? seems
logic.
Going further, for eg. $_SERVER["PHP_AUTH_PW"] is bound to $request->authPw
and then
what will happen if the request will receive "Auth-Pw" header?
a) It'll be bound to $request->headers["auth-pw"] ?
b) It'll be bound to $request->authPw ?
c) None of above.
With those above I would see a set of getters like getContentType() or
getAuthPassword() etc.
instead of ServerRequest instance properties and a single point to retrieve
header values just like
well known ParameterBag's from HttpFoundation to operate on get, post,
headers etc.
BR,
--
Michał Brzuchalski