Hi all,
(Summarized ...)
>> - getQueryParams() - which should return an array or array-like object
>> - getBodyParams() - which would return deserialized body parameters.
>> - setBodyParams($params) - which would allow injecting deserialized
>> body parameters.
>> - getIncomingFiles() - which would essentially return $_FILES
...
>> - getRouteInfo()
>> - setRouteInfo($data)
>
> I think (set|get)PathParams() would make sense here, given my above clarification.
... in further consideration along this path, it may be wise to add getCookieParams() as a representation of $_COOKIE.
On Oct 2, 2014 6:08 PM, "Korvin Szanto" <korvin...@gmail.com> wrote:
>
> > - Setters for query params, incoming files: yea or nay?
> I think setters would only encourage changing the object before the
> request cycle has completed.
> Secondarily, even with setters for those values, I'd probably build
> new request objects for each test already anyway.
Agreed - I've already updated the PR to reflect this.
> > - Methods for adding retrieving route information: yea or nay?
> Wouldn't these methods cause deep coupling?
Not necessarily. The recommendation is to inject an array or array-like object. Most routing solutions already return this, or something capable of providing that information. This would only provide a common interface for getting at that information.
### URI Interface
Second (there was a "First" a few paragraphs back...), I created a
pull request for describing a URI interface:
- https://github.com/php-fig/fig-standards/pull/337
Are there plans for adding methods for working with Cookies?
On Oct 6, 2014, at 5:17 PM, Matthew Weier O'Phinney <mweiero...@gmail.com> wrote:
> So, the bigger question here is: would anybody else need setters for
> cookie parameters? Is it a general use-case the interface should
> support?
Related to this, I am beginning to think that using a plain-old header method for cookies in an outgoing response might be insufficient. PHP itself has setcookie() and setrawcookie() aside from header(); I surmise this is because the cookie format is  relatively specialized, and thus is worthy of special treatment aside from other headers.
With that in mind, it might be useful to pair an OutgoingResponse object, containing setCookie() and setRawCookie() methods, with the new IncomingRequest object to account for this. Â However, doing so would require us to specify how the cookie values are stored, so that they can be retrieved for sending via setcookie() and setrawcookie(). That would add even more to the interface, which I'm pretty sure nobody wants to do at this point. Even so, I think it might be a good addition.
I get that. Even so, cookies appear to be "special enough" that PHP itself has functions for them. I think we can take that as a hint for our work here.
On Oct 6, 2014, at 9:42 PM, Evert Pot wrote:
>
> I get that. Even so, cookies appear to be "special enough" that PHP itself has functions for them. I think we can take that as a hint for our work here.
>
>
> That might just as well be for legacy reasons :)
> This is a slippery slope, and I think it's a bad idea.
Fair. By way of example, what does setting an outgoing cookie look like in the proposal as it exists now?
On Oct 6, 2014, at 9:49 PM, Evert Pot wrote:
>
> On Monday, October 6, 2014 10:45:14 PM UTC-4, pmjones wrote:
>
> On Oct 6, 2014, at 9:42 PM, Evert Pot wrote:
>
> >
> > I get that. Even so, cookies appear to be "special enough" that PHP itself has functions for them. I think we can take that as a hint for our work here.
> >
> >
> > That might just as well be for legacy reasons :)
> > This is a slippery slope, and I think it's a bad idea.
>
> Fair. By way of example, what does setting an outgoing cookie look like in the proposal as it exists now?
>
> Would be something like this:
>
> $response->addHeader('Set-Cookie', 'key=val');
> $response->addHeader('Set-Cookie', 'key=val; Expires=Mon, 06 Oct 2015 22:47:00 GMT');
>
> Aint pretty ;)
Right. There's a lot more to it as well: path, domain, secure, and http only. It's pretty complex, comparatively speaking.
In fact, I think it's the single most complex header in the spec. As I recall, even the cache-related headers are nowhere near as complex. Admittedly their values must be in particular formats, but the end result is "Header: value".
Because I am not fully up on the spec, *is* there any other header that approaches this kind of complexity?
--
You received this message because you are subscribed to the Google Groups "PHP Framework Interoperability Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to php-fig+u...@googlegroups.com.
To post to this group, send email to php...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/php-fig/158b1859-1262-43a5-b079-81c7b8de0dca%40googlegroups.com.
On Oct 7, 2014, at 8:55 AM, Matthew Weier O'Phinney <mweiero...@gmail.com> wrote:
> I did some searching on packagist, and discovered at least a
> half-dozen libraries that implement secure cookie functionality, most
> of them using encryption -- suggesting that the practice is much more
> common than I thought. As such, I'm going to amend the
> IncomingRequestInterface pull request to add setters for cookies.
Given that we're thinking about using external libraries as helpers to build header values in an outgoing response, perhaps the solution here is to use an external library to decode $_COOKIE before injecting them into the IncomingRequest?