- Implement $_FORM

- Update phpinfo()
- Update NEWS
This commit is contained in:
Zeev Suraski 2001-08-08 17:16:20 +00:00
parent 7f4453f4c1
commit 5eb9495b1b
3 changed files with 48 additions and 10 deletions

7
NEWS
View File

@ -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)

View File

@ -301,12 +301,13 @@ PHPAPI void php_print_info(int flag TSRMLS_DC)
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();
}

View File

@ -894,6 +894,7 @@ int php_module_startup(sapi_module_struct *sf)
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 @@ static int php_hash_environment(TSRMLS_D)
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 @@ static int php_hash_environment(TSRMLS_D)
}
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 @@ static int php_hash_environment(TSRMLS_D)
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 @@ static int php_hash_environment(TSRMLS_D)
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;
}
/* }}} */