Skip to content

Commit b966897

Browse files
author
Scott MacVicar
committed
Turns out that more than 1% of users clocks are more than a year out of date, this causes cookies to never get deleted since the date is in the future.
I can only guess its due to batteries on the motherboard being dead.
1 parent 97930e9 commit b966897

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

ext/standard/head.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,9 @@ PHPAPI int php_setcookie(char *name, int name_len, char *value, int value_len, t
114114
/*
115115
* MSIE doesn't delete a cookie when you set it to a null value
116116
* so in order to force cookies to be deleted, even on MSIE, we
117-
* pick an expiry date 1 year and 1 second in the past
117+
* pick an expiry date in the past
118118
*/
119-
time_t t = time(NULL) - 31536001;
120-
dt = php_format_date("D, d-M-Y H:i:s T", sizeof("D, d-M-Y H:i:s T")-1, t, 0 TSRMLS_CC);
119+
dt = php_format_date("D, d-M-Y H:i:s T", sizeof("D, d-M-Y H:i:s T")-1, 1, 0 TSRMLS_CC);
121120
snprintf(cookie, len + 100, "Set-Cookie: %s=deleted; expires=%s", name, dt);
122121
efree(dt);
123122
} else {

0 commit comments

Comments
 (0)