From: foobar Date: Wed, 8 Oct 2003 10:25:39 +0000 (+0000) Subject: - Fixed bug #25780 (MFH: ext/session: invalid session.cookie_lifetime causes crash... X-Git-Tag: php-4.3.4RC2~35 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f0ae93e466cb3f07967a9d4c228c6ab5e6eae829;p=php - Fixed bug #25780 (MFH: ext/session: invalid session.cookie_lifetime causes crash in win32). --- diff --git a/NEWS b/NEWS index 12b0f3d309..4cfb1b5410 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,8 @@ PHP 4 NEWS ?? Oct 2003, Version 4.3.4RC2 - Fixed multibyte regex engine to properly handle ".*" pattern under POSIX compatible mode. (K.Kosako , Moriyoshi) +- Fixed bug #25780 (ext/session: invalid "session.cookie_lifetime" makes + session_start() to crash in win32). (Jani) - Fixed bug #25770 (Segfault with PHP and bison 1.875). (eggert@gnu.org, Marcus) - Fixed bug #25764 (ldap_get_option() crashes with unbound ldap link). (Jani) - Fixed bug #25758 (var_export does not escape ' & \ inside array keys). (Ilia) diff --git a/ext/session/session.c b/ext/session/session.c index 7955f24ff0..4ff76a95e6 100644 --- a/ext/session/session.c +++ b/ext/session/session.c @@ -857,13 +857,17 @@ static void php_session_send_cookie(TSRMLS_D) if (PS(cookie_lifetime) > 0) { struct timeval tv; - + time_t t; + gettimeofday(&tv, NULL); - date_fmt = php_std_date(tv.tv_sec + PS(cookie_lifetime)); + t = tv.tv_sec + PS(cookie_lifetime); - smart_str_appends(&ncookie, COOKIE_EXPIRES); - smart_str_appends(&ncookie, date_fmt); - efree(date_fmt); + if (t > 0) { + date_fmt = php_std_date(t); + smart_str_appends(&ncookie, COOKIE_EXPIRES); + smart_str_appends(&ncookie, date_fmt); + efree(date_fmt); + } } if (PS(cookie_path)[0]) {