Date/Time problem in ./ext/standard/datetime.c

From: Date: Fri, 25 Feb 2000 14:31:58 +0000
Subject: Date/Time problem in ./ext/standard/datetime.c
Groups: php.version4 
Request: Send a blank email to php-version4+get-10946@lists.php.net to get a copy of this message
Kristian- I mistakenly posted this with cvs: in the subject. Perhaps it got filtered into the CVS system... My apologies if this is a dupe and people have already seen it. Kristian Kvhntopp wrote: > It makes PHP4 use four digit year numbers in ./ext/standard/datetime.c > as per > snprintf(str, 80, "%s, %02d-%s-%04d %02d:%02d:%02d GMT", > compared to > snprintf(str, 80, "%s, %02d-%s-%02d %02d:%02d:%02d GMT", > > This date is used in http headers such as cookie headers generated > by PHP. Apache is using four digit year numbers everywhere anyway, > for example Date and Last-Modified. The proposed format is not correct. Pardon my butting in where I may not belong... This is not a Y2K issue so much as an HTTP compliance issue. The _strongly_ preferred format for ALL date/time strings used in HTTP headers, cookies, etc, is given in RFC2068 (HTTP/1.1), section 3.3.1. While that section permits three formats, the preferred format is "RFC 1123" which is exemplified by: Sun, 06 Nov 1994 08:49:37 GMT Note NO DASHES in the date, SHORT day of week name. The RFC **prohibits** the format you propose (so-called "RFC 1036" but with a 4 digit year). Check Apache's Date: and Last-Modified: headers, and check the If-Modified-Since headers sent by any post-1998 browser. For example, http://www.php.net/ (root doc, '/') just gave: HTTP/1.1 200 OK Date: Thu, 24 Feb 2000 16:31:08 GMT Server: Apache 1.3.10-dev (Unix) DAV 0.9.15-dev PHP 4.0b4-dev X-Powered-by: PHP 4.0b4-dev Last-Modified: Thu, 24 Feb 2000 16:09:06 GMT Note the format of the two dates. I am not "on" the design team, so I am in no position to submit patches. However, the HTTP/1.1 compliant code is: 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 { Cheers, and keep up the great work! -- Bob

« previous php.version4 (#10946) next »