Re: [PHP-DEV] Re: setcookie() and Max-Age

2004-08-19 Thread Jason Garber
Hello, +1 on the array parameter. It's flexible, easy to document (as dan put it), and should accommodate future options. Also, throwing E_NOTICES would be good to notify you if you mis-type something, and they can always be suppressed if you want to send an "unsupported" option. -- Best

Re: [PHP-DEV] Re: setcookie() and Max-Age

2004-08-18 Thread Rasmus Lerdorf
On Wed, 18 Aug 2004, Fabrice Vignals wrote: > Also, I don't have any php function in mind, that use a "specific array" ( > array $key fixed ) as argument. I don't think it should necessarily be a fixed array. If someone wants to append something not in the spec to their cookie, why should we sto

Re: [PHP-DEV] Re: setcookie() and Max-Age

2004-08-18 Thread Daniel Convissor
On Wed, Aug 18, 2004 at 08:54:56PM +0200, Fabrice Vignals wrote: > Good new for this feature. > > I think array in arguments is not so good, for documentation + > comprehension + syntax code > > Documentation approximate Syntax : > bool SetCookie( string $name, [string $value], [array $array('

Re: [PHP-DEV] Re: setcookie() and Max-Age

2004-08-18 Thread Fabrice Vignals
Good new for this feature. I think array in arguments is not so good, for documentation + comprehension + syntax code Documentation approximate Syntax : bool SetCookie( string $name, [string $value], [array $array('Max-Age'=> int $max-age, ['Comment'=> string $comment], > ['Path'=> relative||ab

Re: [PHP-DEV] Re: setcookie() and Max-Age

2004-08-18 Thread Christian Schneider
Derick Rethans wrote: How is zend_strtolower() magic? I checked the RFC and we don't even need to convert it to lowercase. RDC 2109: 4.1 Syntax: General: "Attributes (names) (attr) are case-insensitive". BTW: The comment was wrong about Max-Age: -1 to delete a cookie, the RFC says you have to us

Re: [PHP-DEV] Re: setcookie() and Max-Age

2004-08-18 Thread Derick Rethans
On Wed, 18 Aug 2004, Christian Schneider wrote: > Derick Rethans wrote: > > > > It can be made case-insensitive. > > It could be (although this requires some magic) but I'm not sure it > should be. I'd rather document the RFC-conforming way of specifying it. How is zend_strtolower() magic? Deric

Re: [PHP-DEV] Re: setcookie() and Max-Age

2004-08-18 Thread Derick Rethans
On Wed, 18 Aug 2004, Christian Schneider wrote: > Rasmus Lerdorf wrote: > > How about this: > > setcookie('name',$value,array('Max-Age'=>3600, 'Comment'=>$comment, 'Path'=>'/'); > > One drawback is that people have to know about the cookie > specifications, e.g. 'Max-Age': Is it case sensitive,

Re: [PHP-DEV] Re: setcookie() and Max-Age

2004-08-18 Thread Christian Schneider
Rasmus Lerdorf wrote: How about this: setcookie('name',$value,array('Max-Age'=>3600, 'Comment'=>$comment, 'Path'=>'/'); One drawback is that people have to know about the cookie specifications, e.g. 'Max-Age': Is it case sensitive, does it have a dash between max and age, etc? That should at le

Re: [PHP-DEV] Re: setcookie() and Max-Age

2004-08-18 Thread Derick Rethans
On Tue, 17 Aug 2004, Rasmus Lerdorf wrote: > While that is an idea that will probably work, it seems messy to me. Code > with hardcoded expiries in the past that previously wouldn't cause any > cookies to be sent will now suddenly start sending cookies. Right, I think that is a bad idea too. >

Re: [PHP-DEV] Re: setcookie() and Max-Age

2004-08-17 Thread Sterling Hughes
+1 -Sterling On Tue, 17 Aug 2004 18:05:12 -0700 (PDT), Rasmus Lerdorf <[EMAIL PROTECTED]> wrote: > Perhaps it makes more sense to just give it an array there. I agree that > "+3600" is not great either as I am sure someone will try to just pass > +3600 without the quotes. > > How about this: >

Re: [PHP-DEV] Re: setcookie() and Max-Age

2004-08-17 Thread Andi Gutmans
Yeah I think that would work and it'd mean we probably wouldn't have to make any further API changes in the future if new fields arise (famous last words). At 06:05 PM 8/17/2004 -0700, Rasmus Lerdorf wrote: Perhaps it makes more sense to just give it an array there. I agree that "+3600" is not

Re: [PHP-DEV] Re: setcookie() and Max-Age

2004-08-17 Thread Rasmus Lerdorf
Perhaps it makes more sense to just give it an array there. I agree that "+3600" is not great either as I am sure someone will try to just pass +3600 without the quotes. How about this: setcookie('name',$value,array('Max-Age'=>3600, 'Comment'=>$comment, 'Path'=>'/'); So, in this overloaded fo

Re: [PHP-DEV] Re: setcookie() and Max-Age

2004-08-17 Thread Andi Gutmans
I think overloading the type is a good idea. Might even be best to use something which doesn't resemble a number for instance "Max-Age: 3600". We could just send that out in the header if it's a string (although it might leave room for typos). Any other ideas or sexier ways to do the overloading

Re: [PHP-DEV] Re: setcookie() and Max-Age

2004-08-17 Thread Rasmus Lerdorf
No, I think he is saying use Max-Age if the expire is before Sep. 2001. ie. if the expire timestamp looks like a small value and not a timestamp, treat it like a max-age, otherwise if it looks big enough to be a real unix timestamp, make it a normal absolute expiry. While that is an idea that will

[PHP-DEV] Re: setcookie() and Max-Age

2004-08-17 Thread Andi Gutmans
If I understand correctly, what you're saying is that we should always use Max-Age and just do the conversion ourselves? Andi At 01:46 AM 8/18/2004 +0200, Christian Schneider wrote: Andi Gutmans wrote: Not sure if an how this could be added to setcookie() because of the already rich amount of pa

[PHP-DEV] Re: setcookie() and Max-Age

2004-08-17 Thread Christian Schneider
Andi Gutmans wrote: Not sure if an how this could be added to setcookie() because of the already rich amount of parameters it accepts. Would it make sense to have something like setcookie_max_age() or something similar? I think we should overload the expire parameter. Somewhat ugly but transform