Re: PHP 4.0 Bug #5596: SetCookie isn't compliant
| From: | Sterling Hughes | Date: | Fri, 14 Jul 2000 00:57:12 +0000 |
| Subject: | Re: PHP 4.0 Bug #5596: SetCookie isn't compliant | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-24494@lists.php.net to get a copy of this message | ||
> > In developing a WML based system for WAP (Wireless Web Phones) we
discovered a bug with the SetCookie function.
> >
> > The format according to early specifications by Netscape
(http://home.netscape.com/newsref/std/cookie_spec.html) which are all in the
RFC's (linked from that page), which have been adopted by most as the
standard, show the format as:
> >
> > Wdy, DD-Mon-YYYY HH:MM:SS GMT
>
> Actually, this is not the case. The original spec had this format:
>
> Wednesday, 09-Nov-99 23:12:40 GMT
>
> They went back and changed some of the wording, but the very first example
> in the very URL you quoted is:
>
> Set-Cookie: CUSTOMER=WILE_E_COYOTE; path=/; expires=Wednesday, 09-Nov-99
23:12:40 GMT
>
> Note the 2-digit year as well.
>
> -Rasmus
>
I don't know much about this but a quick look at datetime.c shows:
if (PG(y2k_compliance)) {
snprintf(str, 80, "%s, %02d %s %04d %02d:%02d:%02d GMT",
day_short_names[tm1->tm_wday],
tm1->tm_mday,
mon_short_names[tm1->tm_mon],
tm1->tm_year+1900,
tm1->tm_hour, tm1->tm_min, tm1->tm_sec);
} else {
snprintf(str, 80, "%s, %02d-%s-%02d %02d:%02d:%02d GMT",
day_full_names[tm1->tm_wday],
tm1->tm_mday,
mon_short_names[tm1->tm_mon],
((tm1->tm_year)%100),
tm1->tm_hour, tm1->tm_min, tm1->tm_sec);
}
Its seems that when y2k compliance is enabled the format of the string
changes, omitting the dashes.
Sterling