mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
ws, pval -> zval
This commit is contained in:
parent
3080d49ed4
commit
e642d180f6
1 changed files with 40 additions and 56 deletions
|
@ -28,10 +28,8 @@
|
|||
#include "php_content_types.h"
|
||||
#include "SAPI.h"
|
||||
#include "php_logos.h"
|
||||
|
||||
#include "zend_globals.h"
|
||||
|
||||
|
||||
/* for systems that need to override reading of environment variables */
|
||||
void _php_import_environment_variables(zval *array_ptr TSRMLS_DC);
|
||||
PHPAPI void (*php_import_environment_variables)(zval *array_ptr TSRMLS_DC) = _php_import_environment_variables;
|
||||
|
@ -41,7 +39,6 @@ PHPAPI void php_register_variable(char *var, char *strval, zval *track_vars_arra
|
|||
php_register_variable_safe(var, strval, strlen(strval), track_vars_array TSRMLS_CC);
|
||||
}
|
||||
|
||||
|
||||
/* binary-safe version */
|
||||
PHPAPI void php_register_variable_safe(char *var, char *strval, int str_len, zval *track_vars_array TSRMLS_DC)
|
||||
{
|
||||
|
@ -60,8 +57,7 @@ PHPAPI void php_register_variable_safe(char *var, char *strval, int str_len, zva
|
|||
php_register_variable_ex(var, &new_entry, track_vars_array TSRMLS_CC);
|
||||
}
|
||||
|
||||
|
||||
PHPAPI void php_register_variable_ex(char *var, zval *val, pval *track_vars_array TSRMLS_DC)
|
||||
PHPAPI void php_register_variable_ex(char *var, zval *val, zval *track_vars_array TSRMLS_DC)
|
||||
{
|
||||
char *p = NULL;
|
||||
char *ip; /* index pointer */
|
||||
|
@ -195,7 +191,6 @@ plain_var:
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
SAPI_API SAPI_POST_HANDLER_FUNC(php_std_post_handler)
|
||||
{
|
||||
char *var, *val;
|
||||
|
@ -237,7 +232,7 @@ SAPI_API SAPI_TREAT_DATA_FUNC(php_default_treat_data)
|
|||
{
|
||||
char *res = NULL, *var, *val, *separator = NULL;
|
||||
const char *c_var;
|
||||
pval *array_ptr;
|
||||
zval *array_ptr;
|
||||
int free_buffer = 0;
|
||||
char *strtok_buf = NULL;
|
||||
|
||||
|
@ -376,7 +371,6 @@ void _php_import_environment_variables(zval *array_ptr TSRMLS_DC)
|
|||
PG(magic_quotes_gpc) = magic_quotes_gpc;
|
||||
}
|
||||
|
||||
|
||||
zend_bool php_std_auto_global_callback(char *name, uint name_len TSRMLS_DC)
|
||||
{
|
||||
zend_printf("%s\n", name);
|
||||
|
@ -387,7 +381,7 @@ zend_bool php_std_auto_global_callback(char *name, uint name_len TSRMLS_DC)
|
|||
*/
|
||||
static void php_build_argv(char *s, zval *track_vars_array TSRMLS_DC)
|
||||
{
|
||||
pval *arr, *argc, *tmp;
|
||||
zval *arr, *argc, *tmp;
|
||||
int count = 0;
|
||||
char *ss, *space;
|
||||
|
||||
|
@ -410,7 +404,7 @@ static void php_build_argv(char *s, zval *track_vars_array TSRMLS_DC)
|
|||
Z_STRLEN_P(tmp) = strlen(SG(request_info).argv[i]);
|
||||
Z_STRVAL_P(tmp) = estrndup(SG(request_info).argv[i], Z_STRLEN_P(tmp));
|
||||
INIT_PZVAL(tmp);
|
||||
if (zend_hash_next_index_insert(Z_ARRVAL_P(arr), &tmp, sizeof(pval *), NULL)==FAILURE) {
|
||||
if (zend_hash_next_index_insert(Z_ARRVAL_P(arr), &tmp, sizeof(zval *), NULL) == FAILURE) {
|
||||
if (Z_TYPE_P(tmp) == IS_STRING) {
|
||||
efree(Z_STRVAL_P(tmp));
|
||||
}
|
||||
|
@ -430,7 +424,7 @@ static void php_build_argv(char *s, zval *track_vars_array TSRMLS_DC)
|
|||
Z_STRVAL_P(tmp) = estrndup(ss, Z_STRLEN_P(tmp));
|
||||
INIT_PZVAL(tmp);
|
||||
count++;
|
||||
if (zend_hash_next_index_insert(Z_ARRVAL_P(arr), &tmp, sizeof(pval *), NULL)==FAILURE) {
|
||||
if (zend_hash_next_index_insert(Z_ARRVAL_P(arr), &tmp, sizeof(zval *), NULL) == FAILURE) {
|
||||
if (Z_TYPE_P(tmp) == IS_STRING) {
|
||||
efree(Z_STRVAL_P(tmp));
|
||||
}
|
||||
|
@ -464,8 +458,8 @@ static void php_build_argv(char *s, zval *track_vars_array TSRMLS_DC)
|
|||
if (track_vars_array) {
|
||||
arr->refcount++;
|
||||
argc->refcount++;
|
||||
zend_hash_update(Z_ARRVAL_P(track_vars_array), "argv", sizeof("argv"), &arr, sizeof(pval *), NULL);
|
||||
zend_hash_update(Z_ARRVAL_P(track_vars_array), "argc", sizeof("argc"), &argc, sizeof(pval *), NULL);
|
||||
zend_hash_update(Z_ARRVAL_P(track_vars_array), "argv", sizeof("argv"), &arr, sizeof(zval *), NULL);
|
||||
zend_hash_update(Z_ARRVAL_P(track_vars_array), "argc", sizeof("argc"), &argc, sizeof(zval *), NULL);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
@ -474,8 +468,7 @@ static void php_build_argv(char *s, zval *track_vars_array TSRMLS_DC)
|
|||
*/
|
||||
PHPAPI int php_handle_special_queries(TSRMLS_D)
|
||||
{
|
||||
if (SG(request_info).query_string && SG(request_info).query_string[0]=='='
|
||||
&& PG(expose_php)) {
|
||||
if (PG(expose_php) && SG(request_info).query_string && SG(request_info).query_string[0] == '=') {
|
||||
if (php_info_logos(SG(request_info).query_string + 1 TSRMLS_CC)) {
|
||||
return 1;
|
||||
} else if (!strcmp(SG(request_info).query_string + 1, PHP_CREDITS_GUID)) {
|
||||
|
@ -487,8 +480,6 @@ PHPAPI int php_handle_special_queries(TSRMLS_D)
|
|||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
|
||||
/* {{{ php_register_server_variables
|
||||
*/
|
||||
static inline void php_register_server_variables(TSRMLS_D)
|
||||
|
@ -530,8 +521,6 @@ static inline void php_register_server_variables(TSRMLS_D)
|
|||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
|
||||
/* {{{ php_autoglobal_merge
|
||||
*/
|
||||
static void php_autoglobal_merge(HashTable *dest, HashTable *src TSRMLS_DC)
|
||||
|
@ -550,7 +539,8 @@ static void php_autoglobal_merge(HashTable *dest, HashTable *src TSRMLS_DC)
|
|||
if (Z_TYPE_PP(src_entry) != IS_ARRAY
|
||||
|| (key_type == HASH_KEY_IS_STRING && zend_hash_find(dest, string_key, string_key_len, (void **) &dest_entry) != SUCCESS)
|
||||
|| (key_type == HASH_KEY_IS_LONG && zend_hash_index_find(dest, num_key, (void **)&dest_entry) != SUCCESS)
|
||||
|| Z_TYPE_PP(dest_entry) != IS_ARRAY) {
|
||||
|| Z_TYPE_PP(dest_entry) != IS_ARRAY
|
||||
) {
|
||||
(*src_entry)->refcount++;
|
||||
if (key_type == HASH_KEY_IS_STRING) {
|
||||
/* if register_globals is on and working with main symbol table, prevent overwriting of GLOBALS */
|
||||
|
@ -571,12 +561,10 @@ static void php_autoglobal_merge(HashTable *dest, HashTable *src TSRMLS_DC)
|
|||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
static zend_bool php_auto_globals_create_server(char *name, uint name_len TSRMLS_DC);
|
||||
static zend_bool php_auto_globals_create_env(char *name, uint name_len TSRMLS_DC);
|
||||
static zend_bool php_auto_globals_create_request(char *name, uint name_len TSRMLS_DC);
|
||||
|
||||
|
||||
/* {{{ php_hash_environment
|
||||
*/
|
||||
int php_hash_environment(TSRMLS_D)
|
||||
|
@ -703,7 +691,6 @@ int php_hash_environment(TSRMLS_D)
|
|||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
static zend_bool php_auto_globals_create_server(char *name, uint name_len TSRMLS_DC)
|
||||
{
|
||||
php_register_server_variables(TSRMLS_C);
|
||||
|
@ -719,7 +706,6 @@ static zend_bool php_auto_globals_create_server(char *name, uint name_len TSRMLS
|
|||
return 0; /* don't rearm */
|
||||
}
|
||||
|
||||
|
||||
static zend_bool php_auto_globals_create_env(char *name, uint name_len TSRMLS_DC)
|
||||
{
|
||||
zval *env_vars = NULL;
|
||||
|
@ -741,7 +727,6 @@ static zend_bool php_auto_globals_create_env(char *name, uint name_len TSRMLS_DC
|
|||
return 0; /* don't rearm */
|
||||
}
|
||||
|
||||
|
||||
static zend_bool php_auto_globals_create_request(char *name, uint name_len TSRMLS_DC)
|
||||
{
|
||||
zval *form_variables;
|
||||
|
@ -782,7 +767,6 @@ static zend_bool php_auto_globals_create_request(char *name, uint name_len TSRML
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void php_startup_auto_globals(TSRMLS_D)
|
||||
{
|
||||
zend_register_auto_global("_GET", sizeof("_GET")-1, NULL TSRMLS_CC);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue