]> granicus.if.org Git - php/commitdiff
Added a SG(server_context) NULL check to php_apache_getenv.
authorBrian France <bfrance@php.net>
Tue, 28 Jun 2005 16:34:18 +0000 (16:34 +0000)
committerBrian France <bfrance@php.net>
Tue, 28 Jun 2005 16:34:18 +0000 (16:34 +0000)
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 now.

NEWS
sapi/apache/mod_php5.c

diff --git a/NEWS b/NEWS
index 80be2406c7ccbc31caa52cc21fdde977c10e6c01..b4884f3378ae010f0ee8b468aec741e3de93e7e4 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,7 @@ PHP                                                                        NEWS
 ?? ??? 2005, PHP 5.1 Beta 3
 - Added PDO_MYSQL_ATTR_USE_BUFFERED_QUERY parameter for pdo_mysql, to toggle
   usage of buffered queries.
+- Added a SG(server_context) NULL check to php_apache_getenv.  (Brian)
 - Fixed bug #33491 (crash after extending MySQLi internal class). (Tony)
 - Fixed bug #33475 (cURL handle is not closed on curl_close(). (Ilia)
 - Fixed bug #33469 (Compile error undefined reference to ifx_checkAPI). (Jani)
index 41484308c948e3499a2c3f5b71e27d334aa2c19f..0d4a3f4662bccd85cf1e8ca3b307536f8f4fdfbf 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);
 }
 /* }}} */