cvs: php4 / NEWS /ext/standard info.c /main main.c
| From: | Zeev Suraski | Date: | Wed, 08 Aug 2001 17:16:21 +0000 |
| Subject: | cvs: php4 / NEWS /ext/standard info.c /main main.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-6652@lists.php.net to get a copy of this message | ||
zeev Wed Aug 8 13:16:21 2001 EDT
Modified files:
/php4 NEWS
/php4/ext/standard info.c
/php4/main main.c
Log:
- Implement $_FORM
- Update phpinfo()
- Update NEWS
Index: php4/NEWS
diff -u php4/NEWS:1.727 php4/NEWS:1.728
--- php4/NEWS:1.727 Tue Aug 7 20:14:36 2001
+++ php4/NEWS Wed Aug 8 13:16:19 2001
@@ -1,6 +1,13 @@
PHP 4.0 NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? 200?, Version 4.0.7-dev
+- Introduced a new $_FORM variable, which includes any GET, POST or COOKIE
+ variables. Like the other new variables, this variable is also available
+ regardless of the context. (Andi & Zeev)
+- Introduced $_GET, $_POST, $_COOKIE, $_SERVER and $_ENV variables, which
+ deprecate the old $HTTP_*_VARS arrays. In addition to be much shorter to
+ type - these variables are also available regardless of the scope, and
+ there's no need to import them using the 'global' statement. (Andi & Zeev)
- Added vprintf() and vsprintf() functions that allow passing all arguments
after format as an array. (Andrei)
- Added support for GD2 image type for ImageCreateFromString() (Jani)
Index: php4/ext/standard/info.c
diff -u php4/ext/standard/info.c:1.147 php4/ext/standard/info.c:1.148
--- php4/ext/standard/info.c:1.147 Tue Jul 31 00:53:50 2001
+++ php4/ext/standard/info.c Wed Aug 8 13:16:20 2001
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: info.c,v 1.147 2001/07/31 04:53:50 zeev Exp $ */
+/* $Id: info.c,v 1.148 2001/08/08 17:16:20 zeev Exp $ */
#include "php.h"
#include "php_ini.h"
@@ -301,12 +301,13 @@
if (zend_hash_find(&EG(symbol_table), "PHP_AUTH_PW",
sizeof("PHP_AUTH_PW"), (void **) &data) != FAILURE) {
php_info_print_table_row(2, "PHP_AUTH_PW", (*data)->value.str.val);
}
- php_print_gpcse_array("HTTP_GET_VARS", sizeof("HTTP_GET_VARS")-1 TSRMLS_CC);
- php_print_gpcse_array("HTTP_POST_VARS", sizeof("HTTP_POST_VARS")-1
TSRMLS_CC);
- php_print_gpcse_array("HTTP_POST_FILES", sizeof("HTTP_POST_FILES")-1
TSRMLS_CC);
- php_print_gpcse_array("HTTP_COOKIE_VARS", sizeof("HTTP_COOKIE_VARS")-1
TSRMLS_CC);
- php_print_gpcse_array("HTTP_SERVER_VARS", sizeof("HTTP_SERVER_VARS")-1
TSRMLS_CC);
- php_print_gpcse_array("HTTP_ENV_VARS", sizeof("HTTP_ENV_VARS")-1 TSRMLS_CC);
+ php_print_gpcse_array("_FORM", sizeof("_FORM")-1 TSRMLS_CC);
+ php_print_gpcse_array("_GET", sizeof("_GET")-1 TSRMLS_CC);
+ php_print_gpcse_array("_POST", sizeof("_POST")-1 TSRMLS_CC);
+ php_print_gpcse_array("_FILES", sizeof("_FILES")-1 TSRMLS_CC);
+ php_print_gpcse_array("_COOKIE", sizeof("_COOKIE")-1 TSRMLS_CC);
+ php_print_gpcse_array("_SERVER", sizeof("_SERVER")-1 TSRMLS_CC);
+ php_print_gpcse_array("_ENV", sizeof("_ENV")-1 TSRMLS_CC);
php_info_print_table_end();
}
Index: php4/main/main.c
diff -u php4/main/main.c:1.399 php4/main/main.c:1.400
--- php4/main/main.c:1.399 Wed Aug 8 12:36:04 2001
+++ php4/main/main.c Wed Aug 8 13:16:20 2001
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: main.c,v 1.399 2001/08/08 16:36:04 zeev Exp $ */
+/* $Id: main.c,v 1.400 2001/08/08 17:16:20 zeev Exp $ */
/* {{{ includes
*/
@@ -894,6 +894,7 @@
for (i=0; i<6; i++) {
zend_register_auto_global(short_track_vars_names[i], short_track_vars_names_length[i]-1
TSRMLS_CC);
}
+ zend_register_auto_global("_FORM", sizeof("_FORM")-1 TSRMLS_CC);
zend_set_utility_values(&zuv);
php_startup_sapi_content_types();
@@ -1036,6 +1037,7 @@
zval *dummy_track_vars_array;
zend_bool initialized_dummy_track_vars_array=0;
int i;
+ char *variables_order;
char *track_vars_names[] = {
"HTTP_POST_VARS",
"HTTP_GET_VARS",
@@ -1060,10 +1062,10 @@
}
if (PG(variables_order)) {
- p = PG(variables_order);
+ variables_order = PG(variables_order);
have_variables_order=1;
} else {
- p = PG(gpc_order);
+ variables_order = PG(gpc_order);
have_variables_order=0;
ALLOC_ZVAL(PG(http_globals)[TRACK_VARS_ENV]);
array_init(PG(http_globals)[TRACK_VARS_ENV]);
@@ -1071,8 +1073,8 @@
php_import_environment_variables(PG(http_globals)[TRACK_VARS_ENV] TSRMLS_CC);
}
- while(p && *p) {
- switch(*p++) {
+ for (p=variables_order; p && *p; p++) {
+ switch(*p) {
case 'p':
case 'P':
if (!_gpc_flags[0] && !SG(headers_sent) && SG(request_info).request_method
&& !strcasecmp(SG(request_info).request_method, "POST")) {
@@ -1132,6 +1134,34 @@
PG(http_globals)[i]->refcount++;
zend_hash_update(&EG(symbol_table), short_track_vars_names[i],
short_track_vars_names_length[i], &PG(http_globals)[i], sizeof(zval *), NULL);
}
+
+ {
+ zval *form_variables;
+
+ ALLOC_ZVAL(form_variables);
+ array_init(form_variables);
+ INIT_PZVAL(form_variables);
+
+ for (p=variables_order; p && *p; p++) {
+ switch (*p) {
+ case 'g':
+ case 'G':
+ zend_hash_merge(Z_ARRVAL_P(form_variables), Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_GET]),
(void (*)(void *pData)) zval_add_ref, NULL, sizeof(zval *), 0);
+ break;
+ case 'p':
+ case 'P':
+ zend_hash_merge(Z_ARRVAL_P(form_variables), Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_POST]),
(void (*)(void *pData)) zval_add_ref, NULL, sizeof(zval *), 0);
+ break;
+ case 'c':
+ case 'C':
+ zend_hash_merge(Z_ARRVAL_P(form_variables), Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_COOKIE]),
(void (*)(void *pData)) zval_add_ref, NULL, sizeof(zval *), 0);
+ break;
+ }
+ }
+
+ zend_hash_update(&EG(symbol_table), "_FORM", sizeof("_FORM"),
&form_variables, sizeof(zval *), NULL);
+ }
+
return SUCCESS;
}
/* }}} */