From: Antony Dovgal Date: Wed, 2 Aug 2006 09:16:52 +0000 (+0000) Subject: MFH: fix #38289 (segfault in session_decode() when _SESSION is NULL) X-Git-Tag: php-5.2.0RC2~121 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0c4ef446e2cdf23590f41cd785637c1bd7516ebd;p=php MFH: fix #38289 (segfault in session_decode() when _SESSION is NULL) --- diff --git a/NEWS b/NEWS index 7bced946c3..713008bfbb 100644 --- a/NEWS +++ b/NEWS @@ -26,6 +26,8 @@ PHP NEWS - Fixed phpinfo() cutoff of variables at \0. (Ilia) - Fixed a bug in the filter extension that prevented magic_quotes_gpc from being applied when RAW filter is used. (Ilia) +- Fixed bug #38289 (segfault in session_decode() when _SESSION is NULL). + (Tony) - Fixed bug #38278 (session_cache_expire()'s value does not match phpinfo's session.cache_expire). (Tony) - Fixed bug #38269 (fopen wrapper doesn't fail on invalid hostname with diff --git a/ext/session/session.c b/ext/session/session.c index ce578d7191..5afdfd35f4 100644 --- a/ext/session/session.c +++ b/ext/session/session.c @@ -285,9 +285,13 @@ typedef struct { PHPAPI void php_add_session_var(char *name, size_t namelen TSRMLS_DC) { zval **sym_track = NULL; - - zend_hash_find(Z_ARRVAL_P(PS(http_session_vars)), name, namelen + 1, - (void *) &sym_track); + + IF_SESSION_VARS() { + zend_hash_find(Z_ARRVAL_P(PS(http_session_vars)), name, namelen + 1, + (void *) &sym_track); + } else { + return; + } /* * Set up a proper reference between $_SESSION["x"] and $x.