Re: header() removes all header of the same name.
| From: | Yasuo Ohgaki | Date: | Fri, 21 Oct 2016 00:35:59 +0000 |
| Subject: | Re: header() removes all header of the same name. | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-96532@lists.php.net to get a copy of this message | ||
Hi Niklas and all,
On Thu, Oct 20, 2016 at 9:21 PM, Niklas Keller <me@kelunik.com> wrote:
> Before we even discuss disallowing
header("set-cookie")G›k7h›‰�Ž_—
> Â, we should have a
> sane cookie API, e.g. one that like setcookie($name, $value,
> $flags).
>
> That's also the way we implemented it in Aerys
>
> (https://github.com/amphp/aerys/blob/9a7327f062aa678408dfe4f4c3c7f479db16f187/lib/Response.php#L49-L58).
> It's a simple wrapper around addHeader to make life
> easier, but it doesn't
> restrict developers to call setHeader and replace all
> set-cookie
> headers.
We choose current API for reason. It does not look pretty.
This is patch allow array config for 3rd param for setcookie().
https://gist.github.com/yohgaki/b86e07cd450777422c1a467166cd2fd3
I suppose some of us will have opinions having this kind of code(s).
Any comments?
Regards,
--
Yasuo Ohgaki
yohgaki@ohgaki.net