Re: [PHP-DEV] header() removes all header of the same name.

2016-10-24 Thread Yasuo Ohgaki
Hi all, I didn't answer this question and would like to make my point of view clear. On Thu, Oct 20, 2016 at 9:41 PM, Stephen Reay wrote: > Why is your concern so focussed on solving problems for inexperienced > developers, who are effectively using functions incorrectly, at the expense > of e

Re: [PHP-DEV] header() removes all header of the same name.

2016-10-22 Thread Stanislav Malyshev
Hi! > What about API clean up? > Since we have setcookie()/setrawcookie() already, we may clean up > current cookie API > > e.g. > - cookie_set/setcookie($name, [$value, [array $options]]) > (Keep current signature also) > - cookie_set_raw/setrawcookie($name, [$value, [array $options]]) > (Ke

Re: [PHP-DEV] header() removes all header of the same name.

2016-10-21 Thread Yasuo Ohgaki
Hi Stephen, On Fri, Oct 21, 2016 at 5:23 PM, Stephen Reay wrote: >> On 21 Oct 2016, at 13:32, Yasuo Ohgaki wrote: >> >> Hi Stephen, >> >> On Fri, Oct 21, 2016 at 1:38 PM, Stephen Reay >> wrote: >>> Is it normal to alter (or support multiple) function signatures like this, >>> when you want to

Re: [PHP-DEV] header() removes all header of the same name.

2016-10-21 Thread Lester Caine
On 21/10/16 05:38, Stephen Reay wrote: > Is it normal to alter (or support multiple) function signatures like this, > when you want to improve the name *and* improve the signature? Wouldn’t you > just leave setcookie() as-is, introduce the new cookie_* functions, and then > deprecate set cookie

Re: [PHP-DEV] header() removes all header of the same name.

2016-10-21 Thread Stephen Reay
> On 21 Oct 2016, at 13:32, Yasuo Ohgaki wrote: > > Hi Stephen, > > On Fri, Oct 21, 2016 at 1:38 PM, Stephen Reay > wrote: >> Is it normal to alter (or support multiple) function signatures like this, >> when you want to improve the name *and* improve the signature? Wouldn’t you >> just lea

Re: [PHP-DEV] header() removes all header of the same name.

2016-10-20 Thread Yasuo Ohgaki
Hi Stephen, On Fri, Oct 21, 2016 at 1:38 PM, Stephen Reay wrote: > Is it normal to alter (or support multiple) function signatures like this, > when you want to improve the name *and* improve the signature? Wouldn’t you > just leave setcookie() as-is, introduce the new cookie_* functions, and t

Re: [PHP-DEV] header() removes all header of the same name.

2016-10-20 Thread Stephen Reay
Is it normal to alter (or support multiple) function signatures like this, when you want to improve the name *and* improve the signature? Wouldn’t you just leave setcookie() as-is, introduce the new cookie_* functions, and then deprecate set cookie later? (ala mysql => mysqli) As for the specif

Re: [PHP-DEV] header() removes all header of the same name.

2016-10-20 Thread Yasuo Ohgaki
On Fri, Oct 21, 2016 at 9:35 AM, Yasuo Ohgaki wrote: > On Thu, Oct 20, 2016 at 9:21 PM, Niklas Keller wrote: >> Before we even discuss disallowing `header("set-cookie")`, we should have a >> sane cookie API, e.g. one that like `setcookie($name, $value, $flags)`. >> >> That's also the way we imple

Re: [PHP-DEV] header() removes all header of the same name.

2016-10-20 Thread Yasuo Ohgaki
Hi Niklas and all, On Thu, Oct 20, 2016 at 9:21 PM, Niklas Keller wrote: > Before we even discuss disallowing `header("set-cookie")`, 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

Re: [PHP-DEV] header() removes all header of the same name.

2016-10-20 Thread Rick Widmer
On 10/20/2016 4:58 PM, Guy Marriott wrote: FWIW Yasuo, I also think this is a bad idea. If you remove the ability to set cookie _headers_ with the header function then the function needs a more appropriate name - perhaps headerExceptCookie. That makes 5 people opposed - 100% of the individuals w

Re: [PHP-DEV] header() removes all header of the same name.

2016-10-20 Thread Guy Marriott
FWIW Yasuo, I also think this is a bad idea. If you remove the ability to set cookie _headers_ with the header function then the function needs a more appropriate name - perhaps headerExceptCookie. That makes 5 people opposed - 100% of the individuals who have responded in this thread. On Fri, Oc

Re: [PHP-DEV] header() removes all header of the same name.

2016-10-20 Thread Yasuo Ohgaki
Hi Stats, On Fri, Oct 21, 2016 at 5:54 AM, Stanislav Malyshev wrote: > >> The idea is to separate HTTP header handling functions. >> >> - header*() for any HTTP headers except 'Set-Cookie' >> - cookie*() for only 'Set-Cookie' header > > This does not look like a good design. First of all, HTTP

Re: [PHP-DEV] header() removes all header of the same name.

2016-10-20 Thread Yasuo Ohgaki
Hi Stephen, On Thu, Oct 20, 2016 at 9:41 PM, Stephen Reay wrote: >> I don't want to get bug report that session lost or some important >> cookie lost somehow. > > Why is your concern so focussed on solving problems for inexperienced > developers, who are effectively using functions incorrectly,

Re: [PHP-DEV] header() removes all header of the same name.

2016-10-20 Thread Stanislav Malyshev
Hi! > The idea is to separate HTTP header handling functions. > > - header*() for any HTTP headers except 'Set-Cookie' > - cookie*() for only 'Set-Cookie' header This does not look like a good design. First of all, HTTP spec allows multiple instances of any header. Second, making function with

Re: [PHP-DEV] header() removes all header of the same name.

2016-10-20 Thread Christoph M. Becker
On 20.10.2016 at 14:15, Stephen Reay wrote: > As with Niklas, I have no vote, so my *only* option to prevent what I > consider to be a bad decision, is to post to this thread and hope that enough > of those who *do* have voting rights, reject the proposal. > > I understand what you’re proposing

Re: [PHP-DEV] header() removes all header of the same name.

2016-10-20 Thread Stephen Reay
Hi Yasuo, > On 20 Oct 2016, at 19:21, Yasuo Ohgaki wrote: > > Hi Ptephen, > > On Thu, Oct 20, 2016 at 9:15 PM, Stephen Reay > wrote: >> As with Niklas, I have no vote, so my *only* option to prevent what I >> consider to be a bad decision, is to post to this thread and hope that >> enough o

Re: [PHP-DEV] header() removes all header of the same name.

2016-10-20 Thread Yasuo Ohgaki
Hi Niklas, On Thu, Oct 20, 2016 at 9:21 PM, Niklas Keller wrote: > 2016-10-20 13:41 GMT+02:00 Yasuo Ohgaki : >> >> Hi Stephen, >> >> On Thu, Oct 20, 2016 at 8:24 PM, Stephen Reay >> wrote: >> > The *only* solution that retains full control for the developer, is no >> > change. Any “magic” about

Re: [PHP-DEV] header() removes all header of the same name.

2016-10-20 Thread Yasuo Ohgaki
Hi Ptephen, On Thu, Oct 20, 2016 at 9:15 PM, Stephen Reay wrote: > As with Niklas, I have no vote, so my *only* option to prevent what I > consider to be a bad decision, is to post to this thread and hope that enough > of those who *do* have voting rights, reject the proposal. It's okay, but a

Re: [PHP-DEV] header() removes all header of the same name.

2016-10-20 Thread Niklas Keller
2016-10-20 13:41 GMT+02:00 Yasuo Ohgaki : > Hi Stephen, > > On Thu, Oct 20, 2016 at 8:24 PM, Stephen Reay > wrote: > > The *only* solution that retains full control for the developer, is no > > change. Any “magic” about “untouchable” cookie headers (e.g. forcing the > > session cookie header afte

Re: [PHP-DEV] header() removes all header of the same name.

2016-10-20 Thread Stephen Reay
Hi Yasuo, As with Niklas, I have no vote, so my *only* option to prevent what I consider to be a bad decision, is to post to this thread and hope that enough of those who *do* have voting rights, reject the proposal. I understand what you’re proposing. But honestly I don’t even agree with the

Re: [PHP-DEV] header() removes all header of the same name.

2016-10-20 Thread Yasuo Ohgaki
Hi Stephen, On Thu, Oct 20, 2016 at 8:24 PM, Stephen Reay wrote: > The *only* solution that retains full control for the developer, is no > change. Any “magic” about “untouchable” cookie headers (e.g. forcing the > session cookie header after userland cookie headers) takes away options for > the

Re: [PHP-DEV] header() removes all header of the same name.

2016-10-20 Thread Yasuo Ohgaki
Hi Niklas, On Thu, Oct 20, 2016 at 7:39 PM, Niklas Keller wrote: > 016-10-20 11:57 GMT+02:00 Yasuo Ohgaki : >> >> Hi Niklas, >> >> On Thu, Oct 20, 2016 at 6:01 PM, Niklas Keller wrote: >> > >> > same here, it's not acceptable to limit header and restrict >> > `set_cookie`. >> > Just think about

Re: [PHP-DEV] header() removes all header of the same name.

2016-10-20 Thread Stephen Reay
Hi Niklas, There is even a userland hook for the specific functionality you mention: header_register_callback(). But I would argue that no fix is necessary. If you as a developer call session_start(), and then later call header(‘Set-Cookie:…’) with replace left as true, I think it’s safe to a

Re: [PHP-DEV] header() removes all header of the same name.

2016-10-20 Thread Niklas Keller
2016-10-20 11:57 GMT+02:00 Yasuo Ohgaki : > Hi Niklas, > > On Thu, Oct 20, 2016 at 6:01 PM, Niklas Keller wrote: > > > > same here, it's not acceptable to limit header and restrict `set_cookie`. > > Just think about all those frameworks that would have to specialcase > setting > > headers now and

Re: [PHP-DEV] header() removes all header of the same name.

2016-10-20 Thread Yasuo Ohgaki
Hi Niklas, On Thu, Oct 20, 2016 at 6:01 PM, Niklas Keller wrote: > > same here, it's not acceptable to limit header and restrict `set_cookie`. > Just think about all those frameworks that would have to specialcase setting > headers now and have to use the cookie API then. > > If you want to prote

Re: [PHP-DEV] header() removes all header of the same name.

2016-10-20 Thread Niklas Keller
2016-10-20 10:28 GMT+02:00 Yasuo Ohgaki : > Hi Stephen, > > On Thu, Oct 20, 2016 at 5:23 PM, Stephen Reay > wrote: > > Please understand: *no* “solution" where header() loses the ability to > write any arbitrary header will be acceptable in my opinion. > > Thank you for feedback. > I'll include v

Re: [PHP-DEV] header() removes all header of the same name.

2016-10-20 Thread Yasuo Ohgaki
Hi Stephen, On Thu, Oct 20, 2016 at 5:23 PM, Stephen Reay wrote: > Please understand: *no* “solution" where header() loses the ability to write > any arbitrary header will be acceptable in my opinion. Thank you for feedback. I'll include vote option for prohibiting 'Set-Cookie' for header*() R

Re: [PHP-DEV] header() removes all header of the same name.

2016-10-20 Thread Stephen Reay
Hi Yasuo, > On 20 Oct 2016, at 15:10, Yasuo Ohgaki wrote: > > Hi Stephen, > > On Thu, Oct 20, 2016 at 4:48 PM, Stephen Reay wrote: >> >> Just to make my earlier point of view crystal clear: As a purely userland >> party and someone maintaining a PHP framework, I don’t think it’s acceptable

Re: [PHP-DEV] header() removes all header of the same name.

2016-10-20 Thread Yasuo Ohgaki
Hi Stephen, On Thu, Oct 20, 2016 at 4:48 PM, Stephen Reay wrote: > > Just to make my earlier point of view crystal clear: As a purely userland > party and someone maintaining a PHP framework, I don’t think it’s acceptable > to limit which headers header()/header_remove() can operate on, particu

Re: [PHP-DEV] header() removes all header of the same name.

2016-10-20 Thread Stephen Reay
Hi All, Just to make my earlier point of view crystal clear: As a purely userland party and someone maintaining a PHP framework, I don’t think it’s acceptable to limit which headers header()/header_remove() can operate on, particularly when the problem you’re trying to ‘solve’ is simply incorre

Re: [PHP-DEV] header() removes all header of the same name.

2016-10-19 Thread Yasuo Ohgaki
Hi Stas, I posted an an idea for preventing accidental cookie deletion. 'Set-Cookie' is a HTTP header, but provide dedicated functions for it. I pasted it with a little modification. What do you think? Bottom line is I would like to prevent lost session ID by header() in the future. Implement c

Re: [PHP-DEV] header() removes all header of the same name.

2016-10-19 Thread Stanislav Malyshev
Hi! > There is 2 issues. > - header() removes all headers of the same name including 'Set-Cookie' > - header() ignores replace flag. (This one is easy to fix) We have the flag, so if it doesn't work it should be fixed. Also, one should use setcookie() for cookies, usually. > Possible resolut

Re: [PHP-DEV] header() removes all header of the same name.

2016-10-18 Thread Stephen Reay
Hi Yasuo, I agree there are probably a lot using the default, but I think it’s reasonable to expect anyone using a header(‘Set-Cookie:..’); call rather than setcookie() to be aware of the 2nd argument for header(), so this solution sounds good to me. Cheers Stephen > On 18 Oct 2016, at 18:0

Re: [PHP-DEV] header() removes all header of the same name.

2016-10-18 Thread Yasuo Ohgaki
Hi Stephen, On Tue, Oct 18, 2016 at 5:54 PM, Stephen Reay wrote: > If the replace flag was fixed, isn’t this then just a case of making sure > userland sets replace to false if they want existing set-cookie headers > retained? Yes and no. If users use the replace flag correctly, then it will

Re: [PHP-DEV] header() removes all header of the same name.

2016-10-18 Thread Stephen Reay
(Apologies for the dupe, re-sending for the list.) If the replace flag was fixed, isn’t this then just a case of making sure userland sets replace to false if they want existing set-cookie headers retained? Removing the ability to write a custom Set-Cookie header introduces a bigger problem th

[PHP-DEV] header() removes all header of the same name.

2016-10-18 Thread Yasuo Ohgaki
Hi all, I understand why header() is made to remove all headers of the same name. This is needed in some cases, but it does not work well for some cases. We need to decide what to do with https://bugs.php.net/bug.php?id=72997 There is 2 issues. - header() removes all headers of the same name i