#34999 [NEW]: setcookie() uses wrong format for expiry date in http header
From: giunta dot gaetano at sea-aeroportimilano dot it
Operating system: Solaris 8
PHP version: 4.4.0
PHP Bug Type: HTTP related
Bug description: setcookie() uses wrong format for expiry date in http header
Description:
------------
The day-of-week part of the expiry date in the set-cookie http header
generated by PHP uses the full day name instead of the 3 letters
abbreviation (as per RFC 822) on Solaris8 + Apache 2.0.54 + PHP 4.4.0. It
also puts dashes between date parts insted of spaces.
Note that the cookie spec that PHP follows is 'version 0' cookies,
available at:
http://wp.netscape.com/newsref/std/cookie_spec.html
In that spec the mentioned format for time is rfc 822 (which has been
superseded by rfc 1123), which explicitly mentions using 3 letters for
day-of-week and spaces between date parts.
PHP bug #33597 (closed) mentions explicitly rfc 2616 as permitting the
long weekday format, but, imho, it does not applicate to the cookie
header, which should follow only rfc 1123.
BTW: on Linux and Windows, php 4.4.0 uses the rfc 1123 format...
Reproduce code:
---------------
<?php
setcookie('hello', '12345', time()+60*60);
?>
+ use mozilla LiveHTTPHeader to see results:
Expected result:
----------------
HTTP/1.x 200 OK
Date: Thu, 27 Oct 2005 12:44:11 GMT
Server: Apache/2.0.54 (Unix) PHP/4.4.0
X-Powered-By: PHP/4.4.0
Set-Cookie: hello=12345; expires=Thu, 27-Oct-05 13:44:11 GMT
Content-Length: 0
Keep-Alive: timeout=15, max=1000
Connection: Keep-Alive
Content-Type: text/html
Actual result:
--------------
HTTP/1.x 200 OK
Date: Thu, 27 Oct 2005 12:44:11 GMT
Server: Apache/2.0.54 (Unix) PHP/4.4.0
X-Powered-By: PHP/4.4.0
Set-Cookie: hello=12345; expires=Thursday, 27Oct 2005 13:44:11 GMT
Content-Length: 0
Keep-Alive: timeout=15, max=1000
Connection: Keep-Alive
Content-Type: text/html
--
Edit bug report at http://bugs.php.net/?id=34999&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=34999&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=34999&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=34999&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=34999&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=34999&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=34999&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=34999&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=34999&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=34999&r=support
Expected behavior: http://bugs.php.net/fix.php?id=34999&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=34999&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=34999&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=34999&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=34999&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=34999&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=34999&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=34999&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=34999&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=34999&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=34999&r=mysqlcfg
Thread (4 messages)
- giunta dot gaetano at sea-aeroportimilano dot it