]> granicus.if.org Git - php/commitdiff
MFH:
authorBrian France <bfrance@php.net>
Tue, 28 Jun 2005 16:38:03 +0000 (16:38 +0000)
committerBrian France <bfrance@php.net>
Tue, 28 Jun 2005 16:38:03 +0000 (16:38 +0000)
Added a SG(server_context) NULL check to php_apache_getenv.

This can get called when "<key> = ${<key>}:/foo" is used in a .ini file, but <key> has not be set yet.
You will end up with a value of ":/foo", but at least it will not crash.

NEWS
sapi/apache/mod_php5.c

diff --git a/NEWS b/NEWS
index cb6877d96f7325e0a031358dec3e076a68c6aaf0..bddfa249905c1e4386d5aeee32ffa7af757033a2 100644 (file)
--- 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)
index 74707ce7f2b5e05a5f2a238fdb1173b19332ea9b..d7672fd3387f341e0467d42e128f52caf2efb31f 100644 (file)
@@ -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);
 }
 /* }}} */