cvs: /php4 SAPI.c SAPI.h /php4/ext/standard basic_functions.c /php4/sapi/aolserver aolserver.c /php4/sapi/apache mod_php4.c /php4/sapi/cgi cgi_main.c
/php4/sapi/isapi php4isapi.c /php4/sapi/phttpd phttpd.c /php4/sapi/roxen roxen.c /php4/sapi/servlet servlet.c /php4/sapi/thttpd thttpd.c

From: Date: Thu, 10 Feb 2000 17:55:32 +0000
Subject: cvs: /php4 SAPI.c SAPI.h /php4/ext/standard basic_functions.c /php4/sapi/aolserver aolserver.c /php4/sapi/apache mod_php4.c /php4/sapi/cgi cgi_main.c
/php4/sapi/isapi php4isapi.c /php4/sapi/phttpd phttpd.c /php4/sapi/roxen roxen.c /php4/sapi/servlet servlet.c /php4/sapi/thttpd thttpd.c
Groups: php.version4 
Request: Send a blank email to php-version4+get-10047@lists.php.net to get a copy of this message
zeev Thu Feb 10 09:55:32 2000 EDT Modified files: /php4 SAPI.c SAPI.h /php4/ext/standard basic_functions.c /php4/sapi/aolserver aolserver.c /php4/sapi/apache mod_php4.c /php4/sapi/cgi cgi_main.c /php4/sapi/isapi php4isapi.c /php4/sapi/phttpd phttpd.c /php4/sapi/roxen roxen.c /php4/sapi/servlet servlet.c /php4/sapi/thttpd thttpd.c Log: More cleanup - move getenv() to SAPI Index: php4/SAPI.c diff -u php4/SAPI.c:1.45 php4/SAPI.c:1.46 --- php4/SAPI.c:1.45 Thu Feb 10 09:26:55 2000 +++ php4/SAPI.c Thu Feb 10 09:54:59 2000 @@ -402,3 +402,15 @@ return statbuf.st_uid; } } + + +SAPI_API char *sapi_getenv(char *name, int name_len) +{ + if (sapi_module.getenv) { + SLS_FETCH(); + + return sapi_module.getenv(name, name_len SLS_CC); + } else { + return NULL; + } +} \ No newline at end of file Index: php4/SAPI.h diff -u php4/SAPI.h:1.31 php4/SAPI.h:1.32 --- php4/SAPI.h:1.31 Thu Feb 10 09:26:55 2000 +++ php4/SAPI.h Thu Feb 10 09:54:59 2000 @@ -128,6 +128,7 @@ SAPI_API int sapi_flush(); SAPI_API int sapi_get_uid(); +SAPI_API char *sapi_getenv(char *name, int name_len); struct _sapi_module_struct { char *name; @@ -141,6 +142,7 @@ int (*ub_write)(const char *str, unsigned int str_length); void (*flush)(void *server_context); int (*get_uid)(SLS_D); + char *(*getenv)(char *name, int name_len SLS_DC); void (*sapi_error)(int type, const char *error_msg, ...); Index: php4/ext/standard/basic_functions.c diff -u php4/ext/standard/basic_functions.c:1.155 php4/ext/standard/basic_functions.c:1.156 --- php4/ext/standard/basic_functions.c:1.155 Thu Feb 10 07:51:50 2000 +++ php4/ext/standard/basic_functions.c Thu Feb 10 09:54:59 2000 @@ -482,53 +482,26 @@ PHP_FUNCTION(getenv) { -#if FHTTPD - int i; -#endif pval **str; char *ptr; -#if APACHE - SLS_FETCH(); -#endif + if (ARG_COUNT(ht) != 1 || zend_get_parameters_ex(1, &str) == FAILURE) { WRONG_PARAM_COUNT; } convert_to_string_ex(str); -#if FHTTPD - ptr=NULL; - if ((*str)->type == IS_STRING && req){ - for(i=0;i<req->nlines;i++){ - if (req->lines[i].paramc>1){ - if (req->lines[i].params[0]){ - if (!strcmp(req->lines[i].params[0], - (*str)->value.str.val)){ - ptr=req->lines[i].params[1]; - i=req->nlines; - } - } - } - } + if ((*str)->type != IS_STRING) { + RETURN_FALSE; } - if (!ptr) ptr = getenv((*str)->value.str.val); - if (ptr -#else - - if ((*str)->type == IS_STRING && -#if APACHE - ((ptr = (char *)table_get(((request_rec *) SG(server_context))->subprocess_env, (*str)->value.str.val)) || (ptr = getenv((*str)->value.str.val))) -#endif -#if CGI_BINARY - (ptr = getenv((*str)->value.str.val)) -#endif - -#if USE_SAPI - (ptr = sapi_rqst->getenv(sapi_rqst->scid,(*str)->value.str.val)) -#endif -#endif - ) { - RETURN_STRING(ptr,1); + + + ptr = sapi_getenv((*str)->value.str.val, (*str)->value.str.len); + if (!ptr) { + ptr = getenv((*str)->value.str.val); + } + if (ptr) { + RETURN_STRING(ptr, 1); } RETURN_FALSE; } Index: php4/sapi/aolserver/aolserver.c diff -u php4/sapi/aolserver/aolserver.c:1.33 php4/sapi/aolserver/aolserver.c:1.34 --- php4/sapi/aolserver/aolserver.c:1.33 Thu Feb 10 09:26:55 2000 +++ php4/sapi/aolserver/aolserver.c Thu Feb 10 09:55:00 2000 @@ -22,7 +22,7 @@ * - CGI/1.1 conformance */ -/* $Id: aolserver.c,v 1.33 2000/02/10 17:26:55 zeev Exp $ */ +/* $Id: aolserver.c,v 1.34 2000/02/10 17:55:00 zeev Exp $ */ /* conflict between PHP and AOLserver headers */ #define Debug php_Debug @@ -206,7 +206,7 @@ NSLS_FETCH(); PUTS("<table border=5 width=600>\n"); - php_info_print_table_row(2, "SAPI module version", "$Id: aolserver.c,v 1.33 2000/02/10 17:26:55 zeev Exp $"); + php_info_print_table_row(2, "SAPI module version", "$Id: aolserver.c,v 1.34 2000/02/10 17:55:00 zeev Exp $"); php_info_print_table_row(2, "Build date", Ns_InfoBuildDate()); php_info_print_table_row(2, "Config file path", Ns_InfoConfigFile()); php_info_print_table_row(2, "Error Log path", Ns_InfoErrorLog()); @@ -303,6 +303,7 @@ php_ns_sapi_ub_write, /* unbuffered write */ NULL, /* flush */ NULL, /* get uid */ + NULL, /* getenv */ php_error, /* error handler */ Index: php4/sapi/apache/mod_php4.c diff -u php4/sapi/apache/mod_php4.c:1.24 php4/sapi/apache/mod_php4.c:1.25 --- php4/sapi/apache/mod_php4.c:1.24 Thu Feb 10 09:26:55 2000 +++ php4/sapi/apache/mod_php4.c Thu Feb 10 09:55:00 2000 @@ -17,7 +17,7 @@ | PHP 4.0 patches by Zeev Suraski <zeev@zend.com> | +----------------------------------------------------------------------+ */ -/* $Id: mod_php4.c,v 1.24 2000/02/10 17:26:55 zeev Exp $ */ +/* $Id: mod_php4.c,v 1.25 2000/02/10 17:55:00 zeev Exp $ */ #include "zend.h" #include "php.h" @@ -306,6 +306,14 @@ } +static char *php_apache_getenv(char *name, int name_len SLS_DC) +{ + char *value; + + return (char *) table_get(((request_rec *) SG(server_context))->subprocess_env, name)); +} + + static sapi_module_struct sapi_module = { "Apache", /* name */ @@ -318,7 +326,7 @@ sapi_apache_ub_write, /* unbuffered write */ sapi_apache_flush, /* flush */ php_apache_get_uid, /* get uid */ - + php_apache_getenv, /* getenv */ php_error, /* error handler */ Index: php4/sapi/cgi/cgi_main.c diff -u php4/sapi/cgi/cgi_main.c:1.23 php4/sapi/cgi/cgi_main.c:1.24 --- php4/sapi/cgi/cgi_main.c:1.23 Thu Feb 10 09:26:55 2000 +++ php4/sapi/cgi/cgi_main.c Thu Feb 10 09:55:00 2000 @@ -189,6 +189,7 @@ sapi_cgibin_ub_write, /* unbuffered write */ sapi_cgibin_flush, /* flush */ NULL, /* get uid */ + NULL, /* getenv */ php_error, /* error handler */ Index: php4/sapi/isapi/php4isapi.c diff -u php4/sapi/isapi/php4isapi.c:1.19 php4/sapi/isapi/php4isapi.c:1.20 --- php4/sapi/isapi/php4isapi.c:1.19 Thu Feb 10 09:26:55 2000 +++ php4/sapi/isapi/php4isapi.c Thu Feb 10 09:55:00 2000 @@ -351,6 +351,7 @@ sapi_isapi_ub_write, /* unbuffered write */ NULL, /* flush */ NULL, /* get uid */ + NULL, /* getenv */ php_error, /* error handler */ Index: php4/sapi/phttpd/phttpd.c diff -u php4/sapi/phttpd/phttpd.c:1.11 php4/sapi/phttpd/phttpd.c:1.12 --- php4/sapi/phttpd/phttpd.c:1.11 Thu Feb 10 09:26:56 2000 +++ php4/sapi/phttpd/phttpd.c Thu Feb 10 09:55:01 2000 @@ -173,7 +173,8 @@ php_phttpd_sapi_ub_write, /* unbuffered write */ NULL, /* flush */ NULL, /* get uid */ - + NULL, /* getenv */ + php_error, /* error handler */ php_phttpd_sapi_header_handler, /* header handler */ Index: php4/sapi/roxen/roxen.c diff -u php4/sapi/roxen/roxen.c:1.17 php4/sapi/roxen/roxen.c:1.18 --- php4/sapi/roxen/roxen.c:1.17 Thu Feb 10 09:26:56 2000 +++ php4/sapi/roxen/roxen.c Thu Feb 10 09:55:01 2000 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: roxen.c,v 1.17 2000/02/10 17:26:56 zeev Exp $ */ +/* $Id: roxen.c,v 1.18 2000/02/10 17:55:01 zeev Exp $ */ #include "php.h" #ifdef HAVE_ROXEN @@ -470,7 +470,7 @@ /* char buf[512]; */ PUTS("<table border=5 width=600>\n"); - php_info_print_table_row(2, "SAPI module version", "$Id: roxen.c,v 1.17 2000/02/10 17:26:56 zeev Exp $"); + php_info_print_table_row(2, "SAPI module version", "$Id: roxen.c,v 1.18 2000/02/10 17:55:01 zeev Exp $"); /* php_info_print_table_row(2, "Build date", Ns_InfoBuildDate()); php_info_print_table_row(2, "Config file path", Ns_InfoConfigFile()); php_info_print_table_row(2, "Error Log path", Ns_InfoErrorLog()); @@ -527,6 +527,7 @@ php_roxen_sapi_ub_write, /* unbuffered write */ NULL, /* flush */ NULL, /* get uid */ + NULL, /* getenv */ php_error, /* error handler */ Index: php4/sapi/servlet/servlet.c diff -u php4/sapi/servlet/servlet.c:1.16 php4/sapi/servlet/servlet.c:1.17 --- php4/sapi/servlet/servlet.c:1.16 Thu Feb 10 09:26:56 2000 +++ php4/sapi/servlet/servlet.c Thu Feb 10 09:55:01 2000 @@ -222,6 +222,7 @@ sapi_servlet_ub_write, /* unbuffered write */ NULL, /* flush */ NULL, /* get uid */ + NULL, /* getenv */ php_error, /* error handler */ Index: php4/sapi/thttpd/thttpd.c diff -u php4/sapi/thttpd/thttpd.c:1.8 php4/sapi/thttpd/thttpd.c:1.9 --- php4/sapi/thttpd/thttpd.c:1.8 Thu Feb 10 09:26:57 2000 +++ php4/sapi/thttpd/thttpd.c Thu Feb 10 09:55:01 2000 @@ -113,6 +113,7 @@ sapi_thttpd_ub_write, NULL, NULL, /* get uid */ + NULL, /* getenv */ php_error,

« previous php.version4 (#10047) next »