cvs: php4 /main main.c php_variables.c php_variables.h /sapi/cgi cgi_main.c
| From: | Zeev Suraski | Date: | Tue, 07 Nov 2000 18:25:29 +0000 |
| Subject: | cvs: php4 /main main.c php_variables.c php_variables.h /sapi/cgi cgi_main.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-2517@lists.php.net to get a copy of this message | ||
zeev Tue Nov 7 10:25:29 2000 EDT
Modified files:
/php4/main main.c php_variables.c php_variables.h
/php4/sapi/cgi cgi_main.c
Log:
@- In CGI mode, $HTTP_SERVER_VARS now includes all of the environment variables
@ as well (Zeev)
Index: php4/main/main.c
diff -u php4/main/main.c:1.337 php4/main/main.c:1.338
--- php4/main/main.c:1.337 Thu Nov 2 07:47:02 2000
+++ php4/main/main.c Tue Nov 7 10:25:28 2000
@@ -19,7 +19,7 @@
*/
-/* $Id: main.c,v 1.337 2000/11/02 15:47:02 sas Exp $ */
+/* $Id: main.c,v 1.338 2000/11/07 18:25:28 zeev Exp $ */
#include <stdio.h>
@@ -1015,7 +1015,10 @@
} else {
p = PG(gpc_order);
have_variables_order=0;
- php_import_environment_variables(ELS_C PLS_CC);
+ ALLOC_ZVAL(PG(http_globals)[TRACK_VARS_ENV]);
+ array_init(PG(http_globals)[TRACK_VARS_ENV]);
+ INIT_PZVAL(PG(http_globals)[TRACK_VARS_ENV]);
+ php_import_environment_variables(PG(http_globals)[TRACK_VARS_ENV] ELS_CC PLS_CC);
}
while(p && *p) {
@@ -1044,7 +1047,10 @@
case 'e':
case 'E':
if (have_variables_order) {
- php_import_environment_variables(ELS_C PLS_CC);
+ ALLOC_ZVAL(PG(http_globals)[TRACK_VARS_ENV]);
+ array_init(PG(http_globals)[TRACK_VARS_ENV]);
+ INIT_PZVAL(PG(http_globals)[TRACK_VARS_ENV]);
+ php_import_environment_variables(PG(http_globals)[TRACK_VARS_ENV] ELS_CC PLS_CC);
} else {
php_error(E_WARNING, "Unsupported 'e' element (environment) used in gpc_order -
use variables_order instead");
}
Index: php4/main/php_variables.c
diff -u php4/main/php_variables.c:1.18 php4/main/php_variables.c:1.19
--- php4/main/php_variables.c:1.18 Thu Nov 2 07:47:02 2000
+++ php4/main/php_variables.c Tue Nov 7 10:25:29 2000
@@ -301,15 +301,9 @@
-void php_import_environment_variables(ELS_D PLS_DC)
+void php_import_environment_variables(zval *array_ptr ELS_DC PLS_DC)
{
char **env, *p, *t;
- zval *array_ptr=NULL;
-
- ALLOC_ZVAL(array_ptr);
- array_init(array_ptr);
- INIT_PZVAL(array_ptr);
- PG(http_globals)[TRACK_VARS_ENV] = array_ptr;
for (env = environ; env != NULL && *env != NULL; env++) {
p = strchr(*env, '=');
Index: php4/main/php_variables.h
diff -u php4/main/php_variables.h:1.7 php4/main/php_variables.h:1.8
--- php4/main/php_variables.h:1.7 Mon Sep 11 07:50:26 2000
+++ php4/main/php_variables.h Tue Nov 7 10:25:29 2000
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_variables.h,v 1.7 2000/09/11 14:50:26 stas Exp $ */
+/* $Id: php_variables.h,v 1.8 2000/11/07 18:25:29 zeev Exp $ */
#ifndef PHP_VARIABLES_H
#define PHP_VARIABLES_H
@@ -31,7 +31,7 @@
#define PARSE_STRING 3
void php_treat_data(int arg, char *str, zval* destArray ELS_DC PLS_DC SLS_DC);
-void php_import_environment_variables(ELS_D PLS_DC);
+PHPAPI void php_import_environment_variables(zval *array_ptr ELS_DC PLS_DC);
PHPAPI void php_register_variable(char *var, char *val, pval *track_vars_array ELS_DC PLS_DC);
PHPAPI void php_register_variable_ex(char *var, zval *val, pval *track_vars_array ELS_DC PLS_DC);
Index: php4/sapi/cgi/cgi_main.c
diff -u php4/sapi/cgi/cgi_main.c:1.84 php4/sapi/cgi/cgi_main.c:1.85
--- php4/sapi/cgi/cgi_main.c:1.84 Mon Nov 6 01:55:53 2000
+++ php4/sapi/cgi/cgi_main.c Tue Nov 7 10:25:29 2000
@@ -148,6 +148,11 @@
{
char *pi;
+ /* In CGI mode, we consider the environment to be a part of the server
+ * variables
+ */
+ php_import_environment_variables(track_vars_array ELS_CC PLS_CC);
+
/* Build the special-case PHP_SELF variable for the CGI version */
#if FORCE_CGI_REDIRECT
php_register_variable("PHP_SELF", (SG(request_info).request_uri ?
SG(request_info).request_uri:""), track_vars_array ELS_CC PLS_CC);