On 28-08-17 21:06, Stanislav Malyshev wrote: > Something not clear to me on the second one - why lifetime/expiration is > a separate parameter while all others are part of $options?
On Mon, Aug 28, 2017 at 8:53 PM Frederik Bosch <f.bo...@genkgo.nl> wrote: > 1. The session_set_cookie_params function requires a lifetime parameter > at the moment. > > 2. To enforce that lifetime stays required I did not want to make it > required within the optional array. That would make that optional array > not optional anymore, and even have a required key. I don't think that > is a good idea. > > 3. To prevent that the array of options is different between the three > functions (session_set_cookie_params, setcookie, setrawcookie), I chose > to exclude lifetime from the array of options and include it in the list > of arguments. > > Hence, I chose a consistent and logical API over the three functions > together rather than having logical ones per function. Hope it makes sense. > Hi all, This reasoning doesn't make a lot of sense to me. With regards to session_set_cookie_params, I believe that the only reason why lifetime is required in that function is because calling it without parameters doesn't have a purpose. With an array of options (which keeps the first parameter mandatory), there is no strong reason to make one of them required. An empty array or an array without any valid key would still error. If this is acceptable for that function, all the other functions can have all the options in the array as that keeps the array consistent across them. With this being said, would anyone oppose an implementation where all the options (including lifetime) are included in the array parameter? About the implementation, the array of options is never really defined in the RFC. If we assume that it is identical to the proposed output of session_get_cookie_params, the name of the first key should be lifetime. However, for setcookie and setrawcookie, the documented parameter name is expire. Would there be any issue if we would assume lifetime for the 4 functions? Regards, Pedro