From: Brian France Date: Tue, 28 Jun 2005 16:38:03 +0000 (+0000) Subject: MFH: X-Git-Tag: php-5.0.5RC1~108 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f81d41c7621d6f204e26748d676e3d69456494b9;p=php MFH: Added a SG(server_context) NULL check to php_apache_getenv. This can get called when " = ${}:/foo" is used in a .ini file, but has not be set yet. You will end up with a value of ":/foo", but at least it will not crash. --- diff --git a/NEWS b/NEWS index cb6877d96f..bddfa24990 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,7 @@ PHP NEWS ?? ??? 2005, PHP 5.0.5 - Upgraded PCRE library to version 5.0. (Andrei) - Removed php_check_syntax() function which never worked properly. (Ilia) +- Added a SG(server_context) NULL check to php_apache_getenv. (Brian) - Added new function mysqli_set_charset(). (Georg) - Added man pages for "phpize" and "php-config" scripts. (Jakub Vrana) - Added support for .cc files in extensions. (Brian) diff --git a/sapi/apache/mod_php5.c b/sapi/apache/mod_php5.c index 74707ce7f2..d7672fd338 100644 --- a/sapi/apache/mod_php5.c +++ b/sapi/apache/mod_php5.c @@ -352,6 +352,10 @@ static struct stat *php_apache_get_stat(TSRMLS_D) */ static char *php_apache_getenv(char *name, size_t name_len TSRMLS_DC) { + if (SG(server_context) == NULL) { + return NULL; + } + return (char *) table_get(((request_rec *) SG(server_context))->subprocess_env, name); } /* }}} */