From f0ae93e466cb3f07967a9d4c228c6ab5e6eae829 Mon Sep 17 00:00:00 2001 From: foobar Date: Wed, 8 Oct 2003 10:25:39 +0000 Subject: [PATCH] - Fixed bug #25780 (MFH: ext/session: invalid session.cookie_lifetime causes crash in win32). --- NEWS | 2 ++ ext/session/session.c | 14 +++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) 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]) { -- 2.50.1