mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Merged zend_array and HashTable into the single data structure.
Now each HashTable is also zend_array, so it's refcounted and may be a subject for Copy on Write zend_array_dup() was changed to allocate and return HashTable, instead of taking preallocated HashTable as argument.
This commit is contained in:
parent
bc630ad6da
commit
e10e151e9b
40 changed files with 243 additions and 260 deletions
|
@ -110,7 +110,7 @@ PHPAPI void php_register_variable_ex(char *var_name, zval *val, zval *track_vars
|
|||
}
|
||||
|
||||
/* GLOBALS hijack attempt, reject parameter */
|
||||
if (symtable1 == &EG(symbol_table).ht &&
|
||||
if (symtable1 == &EG(symbol_table) &&
|
||||
var_len == sizeof("GLOBALS")-1 &&
|
||||
!memcmp(var, "GLOBALS", sizeof("GLOBALS")-1)) {
|
||||
zval_dtor(val);
|
||||
|
@ -571,8 +571,8 @@ static void php_build_argv(char *s, zval *track_vars_array)
|
|||
|
||||
if (SG(request_info).argc) {
|
||||
Z_ADDREF(arr);
|
||||
zend_hash_str_update(&EG(symbol_table).ht, "argv", sizeof("argv")-1, &arr);
|
||||
zend_hash_str_add(&EG(symbol_table).ht, "argc", sizeof("argc")-1, &argc);
|
||||
zend_hash_str_update(&EG(symbol_table), "argv", sizeof("argv")-1, &arr);
|
||||
zend_hash_str_add(&EG(symbol_table), "argc", sizeof("argc")-1, &argc);
|
||||
}
|
||||
if (track_vars_array && Z_TYPE_P(track_vars_array) == IS_ARRAY) {
|
||||
Z_ADDREF(arr);
|
||||
|
@ -624,7 +624,7 @@ static void php_autoglobal_merge(HashTable *dest, HashTable *src)
|
|||
zval *src_entry, *dest_entry;
|
||||
zend_string *string_key;
|
||||
zend_ulong num_key;
|
||||
int globals_check = (dest == (&EG(symbol_table).ht));
|
||||
int globals_check = (dest == (&EG(symbol_table)));
|
||||
|
||||
ZEND_HASH_FOREACH_KEY_VAL(src, num_key, string_key, src_entry) {
|
||||
if (Z_TYPE_P(src_entry) != IS_ARRAY
|
||||
|
@ -674,7 +674,7 @@ static zend_bool php_auto_globals_create_get(zend_string *name)
|
|||
array_init(&PG(http_globals)[TRACK_VARS_GET]);
|
||||
}
|
||||
|
||||
zend_hash_update(&EG(symbol_table).ht, name, &PG(http_globals)[TRACK_VARS_GET]);
|
||||
zend_hash_update(&EG(symbol_table), name, &PG(http_globals)[TRACK_VARS_GET]);
|
||||
Z_ADDREF(PG(http_globals)[TRACK_VARS_GET]);
|
||||
|
||||
return 0; /* don't rearm */
|
||||
|
@ -693,7 +693,7 @@ static zend_bool php_auto_globals_create_post(zend_string *name)
|
|||
array_init(&PG(http_globals)[TRACK_VARS_POST]);
|
||||
}
|
||||
|
||||
zend_hash_update(&EG(symbol_table).ht, name, &PG(http_globals)[TRACK_VARS_POST]);
|
||||
zend_hash_update(&EG(symbol_table), name, &PG(http_globals)[TRACK_VARS_POST]);
|
||||
Z_ADDREF(PG(http_globals)[TRACK_VARS_POST]);
|
||||
|
||||
return 0; /* don't rearm */
|
||||
|
@ -708,7 +708,7 @@ static zend_bool php_auto_globals_create_cookie(zend_string *name)
|
|||
array_init(&PG(http_globals)[TRACK_VARS_COOKIE]);
|
||||
}
|
||||
|
||||
zend_hash_update(&EG(symbol_table).ht, name, &PG(http_globals)[TRACK_VARS_COOKIE]);
|
||||
zend_hash_update(&EG(symbol_table), name, &PG(http_globals)[TRACK_VARS_COOKIE]);
|
||||
Z_ADDREF(PG(http_globals)[TRACK_VARS_COOKIE]);
|
||||
|
||||
return 0; /* don't rearm */
|
||||
|
@ -720,7 +720,7 @@ static zend_bool php_auto_globals_create_files(zend_string *name)
|
|||
array_init(&PG(http_globals)[TRACK_VARS_FILES]);
|
||||
}
|
||||
|
||||
zend_hash_update(&EG(symbol_table).ht, name, &PG(http_globals)[TRACK_VARS_FILES]);
|
||||
zend_hash_update(&EG(symbol_table), name, &PG(http_globals)[TRACK_VARS_FILES]);
|
||||
Z_ADDREF(PG(http_globals)[TRACK_VARS_FILES]);
|
||||
|
||||
return 0; /* don't rearm */
|
||||
|
@ -735,8 +735,8 @@ static zend_bool php_auto_globals_create_server(zend_string *name)
|
|||
if (SG(request_info).argc) {
|
||||
zval *argc, *argv;
|
||||
|
||||
if ((argc = zend_hash_str_find(&EG(symbol_table).ht, "argc", sizeof("argc")-1)) != NULL &&
|
||||
(argv = zend_hash_str_find(&EG(symbol_table).ht, "argv", sizeof("argv")-1)) != NULL) {
|
||||
if ((argc = zend_hash_str_find(&EG(symbol_table), "argc", sizeof("argc")-1)) != NULL &&
|
||||
(argv = zend_hash_str_find(&EG(symbol_table), "argv", sizeof("argv")-1)) != NULL) {
|
||||
Z_ADDREF_P(argv);
|
||||
zend_hash_str_update(Z_ARRVAL(PG(http_globals)[TRACK_VARS_SERVER]), "argv", sizeof("argv")-1, argv);
|
||||
zend_hash_str_update(Z_ARRVAL(PG(http_globals)[TRACK_VARS_SERVER]), "argc", sizeof("argc")-1, argc);
|
||||
|
@ -751,7 +751,7 @@ static zend_bool php_auto_globals_create_server(zend_string *name)
|
|||
array_init(&PG(http_globals)[TRACK_VARS_SERVER]);
|
||||
}
|
||||
|
||||
zend_hash_update(&EG(symbol_table).ht, name, &PG(http_globals)[TRACK_VARS_SERVER]);
|
||||
zend_hash_update(&EG(symbol_table), name, &PG(http_globals)[TRACK_VARS_SERVER]);
|
||||
Z_ADDREF(PG(http_globals)[TRACK_VARS_SERVER]);
|
||||
|
||||
return 0; /* don't rearm */
|
||||
|
@ -766,7 +766,7 @@ static zend_bool php_auto_globals_create_env(zend_string *name)
|
|||
php_import_environment_variables(&PG(http_globals)[TRACK_VARS_ENV]);
|
||||
}
|
||||
|
||||
zend_hash_update(&EG(symbol_table).ht, name, &PG(http_globals)[TRACK_VARS_ENV]);
|
||||
zend_hash_update(&EG(symbol_table), name, &PG(http_globals)[TRACK_VARS_ENV]);
|
||||
Z_ADDREF(PG(http_globals)[TRACK_VARS_ENV]);
|
||||
|
||||
return 0; /* don't rearm */
|
||||
|
@ -812,7 +812,7 @@ static zend_bool php_auto_globals_create_request(zend_string *name)
|
|||
}
|
||||
}
|
||||
|
||||
zend_hash_update(&EG(symbol_table).ht, name, &form_variables);
|
||||
zend_hash_update(&EG(symbol_table), name, &form_variables);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue