mirror of
https://github.com/php/php-src.git
synced 2025-08-16 14:08:47 +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 "php_content_types.h"
|
||||||
#include "SAPI.h"
|
#include "SAPI.h"
|
||||||
#include "php_logos.h"
|
#include "php_logos.h"
|
||||||
|
|
||||||
#include "zend_globals.h"
|
#include "zend_globals.h"
|
||||||
|
|
||||||
|
|
||||||
/* for systems that need to override reading of environment variables */
|
/* for systems that need to override reading of environment variables */
|
||||||
void _php_import_environment_variables(zval *array_ptr TSRMLS_DC);
|
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;
|
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);
|
php_register_variable_safe(var, strval, strlen(strval), track_vars_array TSRMLS_CC);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* binary-safe version */
|
/* binary-safe version */
|
||||||
PHPAPI void php_register_variable_safe(char *var, char *strval, int str_len, zval *track_vars_array TSRMLS_DC)
|
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);
|
php_register_variable_ex(var, &new_entry, track_vars_array TSRMLS_CC);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PHPAPI void php_register_variable_ex(char *var, zval *val, zval *track_vars_array TSRMLS_DC)
|
||||||
PHPAPI void php_register_variable_ex(char *var, zval *val, pval *track_vars_array TSRMLS_DC)
|
|
||||||
{
|
{
|
||||||
char *p = NULL;
|
char *p = NULL;
|
||||||
char *ip; /* index pointer */
|
char *ip; /* index pointer */
|
||||||
|
@ -195,7 +191,6 @@ plain_var:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SAPI_API SAPI_POST_HANDLER_FUNC(php_std_post_handler)
|
SAPI_API SAPI_POST_HANDLER_FUNC(php_std_post_handler)
|
||||||
{
|
{
|
||||||
char *var, *val;
|
char *var, *val;
|
||||||
|
@ -237,7 +232,7 @@ SAPI_API SAPI_TREAT_DATA_FUNC(php_default_treat_data)
|
||||||
{
|
{
|
||||||
char *res = NULL, *var, *val, *separator = NULL;
|
char *res = NULL, *var, *val, *separator = NULL;
|
||||||
const char *c_var;
|
const char *c_var;
|
||||||
pval *array_ptr;
|
zval *array_ptr;
|
||||||
int free_buffer = 0;
|
int free_buffer = 0;
|
||||||
char *strtok_buf = NULL;
|
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;
|
PG(magic_quotes_gpc) = magic_quotes_gpc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
zend_bool php_std_auto_global_callback(char *name, uint name_len TSRMLS_DC)
|
zend_bool php_std_auto_global_callback(char *name, uint name_len TSRMLS_DC)
|
||||||
{
|
{
|
||||||
zend_printf("%s\n", name);
|
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)
|
static void php_build_argv(char *s, zval *track_vars_array TSRMLS_DC)
|
||||||
{
|
{
|
||||||
pval *arr, *argc, *tmp;
|
zval *arr, *argc, *tmp;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
char *ss, *space;
|
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_STRLEN_P(tmp) = strlen(SG(request_info).argv[i]);
|
||||||
Z_STRVAL_P(tmp) = estrndup(SG(request_info).argv[i], Z_STRLEN_P(tmp));
|
Z_STRVAL_P(tmp) = estrndup(SG(request_info).argv[i], Z_STRLEN_P(tmp));
|
||||||
INIT_PZVAL(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) {
|
if (Z_TYPE_P(tmp) == IS_STRING) {
|
||||||
efree(Z_STRVAL_P(tmp));
|
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));
|
Z_STRVAL_P(tmp) = estrndup(ss, Z_STRLEN_P(tmp));
|
||||||
INIT_PZVAL(tmp);
|
INIT_PZVAL(tmp);
|
||||||
count++;
|
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) {
|
if (Z_TYPE_P(tmp) == IS_STRING) {
|
||||||
efree(Z_STRVAL_P(tmp));
|
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) {
|
if (track_vars_array) {
|
||||||
arr->refcount++;
|
arr->refcount++;
|
||||||
argc->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), "argv", sizeof("argv"), &arr, sizeof(zval *), 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), "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)
|
PHPAPI int php_handle_special_queries(TSRMLS_D)
|
||||||
{
|
{
|
||||||
if (SG(request_info).query_string && SG(request_info).query_string[0]=='='
|
if (PG(expose_php) && SG(request_info).query_string && SG(request_info).query_string[0] == '=') {
|
||||||
&& PG(expose_php)) {
|
|
||||||
if (php_info_logos(SG(request_info).query_string + 1 TSRMLS_CC)) {
|
if (php_info_logos(SG(request_info).query_string + 1 TSRMLS_CC)) {
|
||||||
return 1;
|
return 1;
|
||||||
} else if (!strcmp(SG(request_info).query_string + 1, PHP_CREDITS_GUID)) {
|
} 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
|
/* {{{ php_register_server_variables
|
||||||
*/
|
*/
|
||||||
static inline void php_register_server_variables(TSRMLS_D)
|
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
|
/* {{{ php_autoglobal_merge
|
||||||
*/
|
*/
|
||||||
static void php_autoglobal_merge(HashTable *dest, HashTable *src TSRMLS_DC)
|
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
|
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_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)
|
|| (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++;
|
(*src_entry)->refcount++;
|
||||||
if (key_type == HASH_KEY_IS_STRING) {
|
if (key_type == HASH_KEY_IS_STRING) {
|
||||||
/* if register_globals is on and working with main symbol table, prevent overwriting of GLOBALS */
|
/* 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_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_env(char *name, uint name_len TSRMLS_DC);
|
||||||
static zend_bool php_auto_globals_create_request(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
|
/* {{{ php_hash_environment
|
||||||
*/
|
*/
|
||||||
int php_hash_environment(TSRMLS_D)
|
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)
|
static zend_bool php_auto_globals_create_server(char *name, uint name_len TSRMLS_DC)
|
||||||
{
|
{
|
||||||
php_register_server_variables(TSRMLS_C);
|
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 */
|
return 0; /* don't rearm */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static zend_bool php_auto_globals_create_env(char *name, uint name_len TSRMLS_DC)
|
static zend_bool php_auto_globals_create_env(char *name, uint name_len TSRMLS_DC)
|
||||||
{
|
{
|
||||||
zval *env_vars = NULL;
|
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 */
|
return 0; /* don't rearm */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static zend_bool php_auto_globals_create_request(char *name, uint name_len TSRMLS_DC)
|
static zend_bool php_auto_globals_create_request(char *name, uint name_len TSRMLS_DC)
|
||||||
{
|
{
|
||||||
zval *form_variables;
|
zval *form_variables;
|
||||||
|
@ -782,7 +767,6 @@ static zend_bool php_auto_globals_create_request(char *name, uint name_len TSRML
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void php_startup_auto_globals(TSRMLS_D)
|
void php_startup_auto_globals(TSRMLS_D)
|
||||||
{
|
{
|
||||||
zend_register_auto_global("_GET", sizeof("_GET")-1, NULL TSRMLS_CC);
|
zend_register_auto_global("_GET", sizeof("_GET")-1, NULL TSRMLS_CC);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue