diff options
Diffstat (limited to 'ext')
-rw-r--r-- | ext/dom/php_dom.c | 4 | ||||
-rw-r--r-- | ext/gmp/gmp.c | 7 | ||||
-rw-r--r-- | ext/opcache/ZendAccelerator.c | 16 | ||||
-rw-r--r-- | ext/opcache/zend_accelerator_util_funcs.c | 4 | ||||
-rw-r--r-- | ext/readline/readline_cli.c | 2 | ||||
-rw-r--r-- | ext/session/session.c | 20 | ||||
-rw-r--r-- | ext/soap/soap.c | 12 | ||||
-rw-r--r-- | ext/spl/spl_array.c | 41 | ||||
-rw-r--r-- | ext/spl/spl_directory.c | 4 | ||||
-rw-r--r-- | ext/spl/spl_observer.c | 3 | ||||
-rw-r--r-- | ext/standard/array.c | 29 | ||||
-rw-r--r-- | ext/standard/basic_functions.c | 2 | ||||
-rw-r--r-- | ext/standard/browscap.c | 3 | ||||
-rw-r--r-- | ext/standard/http_fopen_wrapper.c | 2 | ||||
-rw-r--r-- | ext/standard/info.c | 10 | ||||
-rw-r--r-- | ext/wddx/wddx.c | 2 |
16 files changed, 71 insertions, 90 deletions
diff --git a/ext/dom/php_dom.c b/ext/dom/php_dom.c index 04c7e3a40e..9e174fe997 100644 --- a/ext/dom/php_dom.c +++ b/ext/dom/php_dom.c @@ -424,10 +424,8 @@ static HashTable* dom_get_debug_info_helper(zval *object, int *is_temp) /* {{{ * *is_temp = 1; - ALLOC_HASHTABLE(debug_info); - std_props = zend_std_get_properties(object); - zend_array_dup(debug_info, std_props); + debug_info = zend_array_dup(std_props); if (!prop_handlers) { return debug_info; diff --git a/ext/gmp/gmp.c b/ext/gmp/gmp.c index 7d591e2383..a64da90745 100644 --- a/ext/gmp/gmp.c +++ b/ext/gmp/gmp.c @@ -433,8 +433,7 @@ static HashTable *gmp_get_debug_info(zval *obj, int *is_temp) /* {{{ */ zval zv; *is_temp = 1; - ALLOC_HASHTABLE(ht); - zend_array_dup(ht, props); + ht = zend_array_dup(props); gmp_strval(&zv, gmpnum, 10); zend_hash_str_update(ht, "num", sizeof("num")-1, &zv); @@ -560,7 +559,6 @@ static int gmp_serialize(zval *object, unsigned char **buffer, size_t *buf_len, smart_str buf = {0}; zval zv; php_serialize_data_t serialize_data = (php_serialize_data_t) data; - zend_array tmp_arr; PHP_VAR_SERIALIZE_INIT(serialize_data); @@ -568,8 +566,7 @@ static int gmp_serialize(zval *object, unsigned char **buffer, size_t *buf_len, php_var_serialize(&buf, &zv, &serialize_data); zval_dtor(&zv); - ZVAL_ARR(&zv, &tmp_arr); - tmp_arr.ht = *zend_std_get_properties(object); + ZVAL_ARR(&zv, zend_std_get_properties(object)); php_var_serialize(&buf, &zv, &serialize_data); PHP_VAR_SERIALIZE_DESTROY(serialize_data); diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index ebe7942e7f..4823609ca1 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -1239,7 +1239,7 @@ static int zend_accel_get_auto_globals(void) int mask = 0; for (i = 0; i < ag_size ; i++) { - if (zend_hash_exists(&EG(symbol_table).ht, jit_auto_globals_str[i])) { + if (zend_hash_exists(&EG(symbol_table), jit_auto_globals_str[i])) { mask |= n; } n += n; @@ -1249,7 +1249,7 @@ static int zend_accel_get_auto_globals(void) static int zend_accel_get_auto_globals_no_jit(void) { - if (zend_hash_exists(&EG(symbol_table).ht, jit_auto_globals_str[3])) { + if (zend_hash_exists(&EG(symbol_table), jit_auto_globals_str[3])) { return 8; } return 0; @@ -2002,21 +2002,21 @@ static inline void zend_accel_fast_del_bucket(HashTable *ht, uint32_t idx, Bucke static void zend_accel_fast_shutdown(void) { if (EG(full_tables_cleanup)) { - EG(symbol_table).ht.pDestructor = accel_fast_zval_dtor; + EG(symbol_table).pDestructor = accel_fast_zval_dtor; } else { dtor_func_t old_destructor; if (EG(objects_store).top > 1 || zend_hash_num_elements(&EG(regular_list)) > 0) { /* We don't have to destroy all zvals if they cannot call any destructors */ - old_destructor = EG(symbol_table).ht.pDestructor; - EG(symbol_table).ht.pDestructor = accel_fast_zval_dtor; + old_destructor = EG(symbol_table).pDestructor; + EG(symbol_table).pDestructor = accel_fast_zval_dtor; zend_try { - zend_hash_graceful_reverse_destroy(&EG(symbol_table).ht); + zend_hash_graceful_reverse_destroy(&EG(symbol_table)); } zend_end_try(); - EG(symbol_table).ht.pDestructor = old_destructor; + EG(symbol_table).pDestructor = old_destructor; } - zend_hash_init(&EG(symbol_table).ht, 8, NULL, NULL, 0); + zend_hash_init(&EG(symbol_table), 8, NULL, NULL, 0); ZEND_HASH_REVERSE_FOREACH(EG(function_table), 0) { zend_function *func = Z_PTR(_p->val); diff --git a/ext/opcache/zend_accelerator_util_funcs.c b/ext/opcache/zend_accelerator_util_funcs.c index 457b78cfc8..dc717ca768 100644 --- a/ext/opcache/zend_accelerator_util_funcs.c +++ b/ext/opcache/zend_accelerator_util_funcs.c @@ -212,7 +212,7 @@ static inline void zend_clone_zval(zval *src, int bind) if (bind && Z_REFCOUNT_P(src) > 1) { accel_xlat_set(old, Z_ARR_P(src)); } - zend_hash_clone_zval(Z_ARRVAL_P(src), &old->ht, 0); + zend_hash_clone_zval(Z_ARRVAL_P(src), old, 0); } } break; @@ -378,6 +378,8 @@ static zend_always_inline void zend_prepare_function_for_execution(zend_op_array HashTable *shared_statics = op_array->static_variables; ALLOC_HASHTABLE(op_array->static_variables); + GC_REFCOUNT(op_array->static_variables) = 1; + GC_TYPE(op_array->static_variables) = IS_ARRAY; zend_hash_clone_zval(op_array->static_variables, shared_statics, 0); } } diff --git a/ext/readline/readline_cli.c b/ext/readline/readline_cli.c index a9b138bfb1..df3ba20c85 100644 --- a/ext/readline/readline_cli.c +++ b/ext/readline/readline_cli.c @@ -430,7 +430,7 @@ static char *cli_completion_generator_var(const char *text, int textlen, int *st char *retval, *tmp; zend_array *symbol_table = &EG(symbol_table); - tmp = retval = cli_completion_generator_ht(text + 1, textlen - 1, state, symbol_table ? &symbol_table->ht : NULL, NULL); + tmp = retval = cli_completion_generator_ht(text + 1, textlen - 1, state, symbol_table, NULL); if (retval) { retval = malloc(strlen(tmp) + 2); retval[0] = '$'; diff --git a/ext/session/session.c b/ext/session/session.c index 4d03547172..782618dff7 100644 --- a/ext/session/session.c +++ b/ext/session/session.c @@ -205,7 +205,7 @@ static void php_session_track_init(void) /* {{{ */ array_init(&session_vars); ZVAL_NEW_REF(&PS(http_session_vars), &session_vars); Z_ADDREF_P(&PS(http_session_vars)); - zend_hash_update_ind(&EG(symbol_table).ht, var_name, &PS(http_session_vars)); + zend_hash_update_ind(&EG(symbol_table), var_name, &PS(http_session_vars)); zend_string_release(var_name); } /* }}} */ @@ -311,7 +311,7 @@ PHPAPI zend_string *php_session_create_id(PS_CREATE_SID_ARGS) /* {{{ */ gettimeofday(&tv, NULL); - if ((array = zend_hash_str_find(&EG(symbol_table).ht, "_SERVER", sizeof("_SERVER") - 1)) && + if ((array = zend_hash_str_find(&EG(symbol_table), "_SERVER", sizeof("_SERVER") - 1)) && Z_TYPE_P(array) == IS_ARRAY && (token = zend_hash_str_find(Z_ARRVAL_P(array), "REMOTE_ADDR", sizeof("REMOTE_ADDR") - 1)) && Z_TYPE_P(token) == IS_STRING @@ -874,7 +874,7 @@ PS_SERIALIZER_DECODE_FUNC(php_serialize) /* {{{ */ } ZVAL_NEW_REF(&PS(http_session_vars), &session_vars); Z_ADDREF_P(&PS(http_session_vars)); - zend_hash_update_ind(&EG(symbol_table).ht, var_name, &PS(http_session_vars)); + zend_hash_update_ind(&EG(symbol_table), var_name, &PS(http_session_vars)); zend_string_release(var_name); return SUCCESS; } @@ -936,8 +936,8 @@ PS_SERIALIZER_DECODE_FUNC(php_binary) /* {{{ */ p += namelen + 1; - if ((tmp = zend_hash_find(&EG(symbol_table).ht, name))) { - if ((Z_TYPE_P(tmp) == IS_ARRAY && Z_ARRVAL_P(tmp) == &EG(symbol_table).ht) || tmp == &PS(http_session_vars)) { + if ((tmp = zend_hash_find(&EG(symbol_table), name))) { + if ((Z_TYPE_P(tmp) == IS_ARRAY && Z_ARRVAL_P(tmp) == &EG(symbol_table)) || tmp == &PS(http_session_vars)) { efree(name); continue; } @@ -1027,8 +1027,8 @@ PS_SERIALIZER_DECODE_FUNC(php) /* {{{ */ name = zend_string_init(p, namelen, 0); q++; - if ((tmp = zend_hash_find(&EG(symbol_table).ht, name))) { - if ((Z_TYPE_P(tmp) == IS_ARRAY && Z_ARRVAL_P(tmp) == &EG(symbol_table).ht) || tmp == &PS(http_session_vars)) { + if ((tmp = zend_hash_find(&EG(symbol_table), name))) { + if ((Z_TYPE_P(tmp) == IS_ARRAY && Z_ARRVAL_P(tmp) == &EG(symbol_table)) || tmp == &PS(http_session_vars)) { goto skip; } } @@ -1545,7 +1545,7 @@ PHPAPI void php_session_start(void) /* {{{ */ */ if (!PS(id)) { - if (PS(use_cookies) && (data = zend_hash_str_find(&EG(symbol_table).ht, "_COOKIE", sizeof("_COOKIE") - 1)) && + if (PS(use_cookies) && (data = zend_hash_str_find(&EG(symbol_table), "_COOKIE", sizeof("_COOKIE") - 1)) && Z_TYPE_P(data) == IS_ARRAY && (ppid = zend_hash_str_find(Z_ARRVAL_P(data), PS(session_name), lensess)) ) { @@ -1554,7 +1554,7 @@ PHPAPI void php_session_start(void) /* {{{ */ } if (PS(define_sid) && !PS(id) && - (data = zend_hash_str_find(&EG(symbol_table).ht, "_GET", sizeof("_GET") - 1)) && + (data = zend_hash_str_find(&EG(symbol_table), "_GET", sizeof("_GET") - 1)) && Z_TYPE_P(data) == IS_ARRAY && (ppid = zend_hash_str_find(Z_ARRVAL_P(data), PS(session_name), lensess)) ) { @@ -1562,7 +1562,7 @@ PHPAPI void php_session_start(void) /* {{{ */ } if (PS(define_sid) && !PS(id) && - (data = zend_hash_str_find(&EG(symbol_table).ht, "_POST", sizeof("_POST") - 1)) && + (data = zend_hash_str_find(&EG(symbol_table), "_POST", sizeof("_POST") - 1)) && Z_TYPE_P(data) == IS_ARRAY && (ppid = zend_hash_str_find(Z_ARRVAL_P(data), PS(session_name), lensess)) ) { diff --git a/ext/soap/soap.c b/ext/soap/soap.c index 64c79c80d6..6d66ffdc8d 100644 --- a/ext/soap/soap.c +++ b/ext/soap/soap.c @@ -1189,8 +1189,7 @@ PHP_METHOD(SoapServer, SoapServer) if ((tmp = zend_hash_str_find(ht, "classmap", sizeof("classmap")-1)) != NULL && Z_TYPE_P(tmp) == IS_ARRAY) { - ALLOC_HASHTABLE(service->class_map); - zend_array_dup(service->class_map, Z_ARRVAL_P(tmp)); + service->class_map = zend_array_dup(Z_ARRVAL_P(tmp)); } if ((tmp = zend_hash_str_find(ht, "typemap", sizeof("typemap")-1)) != NULL && @@ -1571,7 +1570,7 @@ PHP_METHOD(SoapServer, handle) zend_string *server = zend_string_init("_SERVER", sizeof("_SERVER") - 1, 0); zend_is_auto_global(server); - if ((server_vars = zend_hash_find(&EG(symbol_table).ht, server)) != NULL && + if ((server_vars = zend_hash_find(&EG(symbol_table), server)) != NULL && Z_TYPE_P(server_vars) == IS_ARRAY && (encoding = zend_hash_str_find(Z_ARRVAL_P(server_vars), "HTTP_CONTENT_ENCODING", sizeof("HTTP_CONTENT_ENCODING")-1)) != NULL && Z_TYPE_P(encoding) == IS_STRING) { @@ -2914,9 +2913,7 @@ PHP_METHOD(SoapClient, __call) HashTable *default_headers = Z_ARRVAL_P(tmp); if (soap_headers) { if (!free_soap_headers) { - HashTable *t = emalloc(sizeof(HashTable)); - zend_array_dup(t, soap_headers); - soap_headers = t; + soap_headers = zend_array_dup(soap_headers); free_soap_headers = 1; } ZEND_HASH_FOREACH_VAL(default_headers, tmp) { @@ -3164,8 +3161,7 @@ PHP_METHOD(SoapClient, __getCookies) if ((cookies = zend_hash_str_find(Z_OBJPROP_P(getThis()), "_cookies", sizeof("_cookies")-1)) != NULL) { - ZVAL_NEW_ARR(return_value); - zend_array_dup(Z_ARRVAL_P(return_value), Z_ARRVAL_P(cookies)); + ZVAL_ARR(return_value, zend_array_dup(Z_ARRVAL_P(cookies))); } else { array_init(return_value); } diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c index 0ae066dbfb..5cdd333688 100644 --- a/ext/spl/spl_array.c +++ b/ext/spl/spl_array.c @@ -198,8 +198,7 @@ static zend_object *spl_array_object_new_ex(zend_class_entry *class_type, zval * if (clone_orig) { intern->array = other->array; if (Z_OBJ_HT_P(orig) == &spl_handler_ArrayObject) { - ZVAL_NEW_ARR(&intern->array); - zend_array_dup(Z_ARRVAL(intern->array), HASH_OF(&other->array)); + ZVAL_ARR(&intern->array, zend_array_dup(HASH_OF(&other->array))); } if (Z_OBJ_HT_P(orig) == &spl_handler_ArrayIterator) { Z_ADDREF_P(&other->array); @@ -553,7 +552,7 @@ static void spl_array_unset_dimension_ex(int check_inherited, zval *object, zval zend_error(E_WARNING, "Modification of ArrayObject during sorting is prohibited"); return; } - if (ht == &EG(symbol_table).ht) { + if (ht == &EG(symbol_table)) { if (zend_delete_global_variable(Z_STR_P(offset))) { zend_error(E_NOTICE,"Undefined index: %s", Z_STRVAL_P(offset)); } @@ -824,8 +823,7 @@ SPL_METHOD(Array, getArrayCopy) zval *object = getThis(); spl_array_object *intern = Z_SPLARRAY_P(object); - ZVAL_NEW_ARR(return_value); - zend_array_dup(Z_ARRVAL_P(return_value), spl_array_get_hash_table(intern, 0)); + ZVAL_ARR(return_value, zend_array_dup(spl_array_get_hash_table(intern, 0))); } /* }}} */ static HashTable *spl_array_get_properties(zval *object) /* {{{ */ @@ -1141,10 +1139,6 @@ static void spl_array_it_rewind(zend_object_iterator *iter) /* {{{ */ /* {{{ spl_array_set_array */ static void spl_array_set_array(zval *object, spl_array_object *intern, zval *array, zend_long ar_flags, int just_array) { - if (Z_TYPE_P(array) == IS_ARRAY) { - SEPARATE_ARRAY(array); - } - if (Z_TYPE_P(array) == IS_OBJECT && (Z_OBJ_HT_P(array) == &spl_handler_ArrayObject || Z_OBJ_HT_P(array) == &spl_handler_ArrayIterator)) { zval_ptr_dtor(&intern->array); if (just_array) { @@ -1152,14 +1146,12 @@ static void spl_array_set_array(zval *object, spl_array_object *intern, zval *ar ar_flags = other->ar_flags & ~SPL_ARRAY_INT_MASK; } ar_flags |= SPL_ARRAY_USE_OTHER; - ZVAL_COPY_VALUE(&intern->array, array); } else { if (Z_TYPE_P(array) != IS_OBJECT && Z_TYPE_P(array) != IS_ARRAY) { zend_throw_exception(spl_ce_InvalidArgumentException, "Passed variable is not an array or object, using empty array instead", 0); return; } zval_ptr_dtor(&intern->array); - ZVAL_COPY_VALUE(&intern->array, array); } if (Z_TYPE_P(array) == IS_OBJECT && Z_OBJ_P(object) == Z_OBJ_P(array)) { intern->ar_flags |= SPL_ARRAY_IS_SELF; @@ -1168,8 +1160,11 @@ static void spl_array_set_array(zval *object, spl_array_object *intern, zval *ar intern->ar_flags &= ~SPL_ARRAY_IS_SELF; } intern->ar_flags |= ar_flags; - Z_ADDREF_P(&intern->array); - if (Z_TYPE_P(array) == IS_OBJECT) { + if (Z_TYPE_P(array) == IS_ARRAY) { + //??? TODO: try to avoid array duplication + ZVAL_DUP(&intern->array, array); + } else { + ZVAL_COPY(&intern->array, array); zend_object_get_properties_t handler = Z_OBJ_HANDLER_P(array, get_properties); if ((handler != std_object_handlers.get_properties && handler != spl_array_get_properties) || !spl_array_get_hash_table(intern, 0)) { @@ -1327,8 +1322,7 @@ SPL_METHOD(Array, exchangeArray) zval *object = getThis(), *array; spl_array_object *intern = Z_SPLARRAY_P(object); - ZVAL_NEW_ARR(return_value); - zend_array_dup(Z_ARRVAL_P(return_value), spl_array_get_hash_table(intern, 0)); + ZVAL_ARR(return_value, zend_array_dup(spl_array_get_hash_table(intern, 0))); if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &array) == FAILURE) { return; } @@ -1480,11 +1474,13 @@ static void spl_array_method(INTERNAL_FUNCTION_PARAMETERS, char *fname, int fnam HashTable *aht = spl_array_get_hash_table(intern, 0); zval tmp, *arg = NULL; zval retval; + uint32_t old_refcount; - /* A tricky way to pass "aht" by reference, copy HashTable */ + /* A tricky way to pass "aht" by reference, reset refcount */ //??? It may be not safe, if user comparison handler accesses "aht" - ZVAL_NEW_ARR(&tmp); - *Z_ARRVAL(tmp) = *aht; + old_refcount = GC_REFCOUNT(aht); + GC_REFCOUNT(aht) = 1; + ZVAL_ARR(&tmp, aht); if (!use_arg) { aht->u.v.nApplyCount++; @@ -1492,7 +1488,7 @@ static void spl_array_method(INTERNAL_FUNCTION_PARAMETERS, char *fname, int fnam aht->u.v.nApplyCount--; } else if (use_arg == SPL_ARRAY_METHOD_MAY_USER_ARG) { if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "|z", &arg) == FAILURE) { - zval_ptr_dtor(&tmp); + GC_REFCOUNT(aht) = old_refcount; zend_throw_exception(spl_ce_BadMethodCallException, "Function expects one argument at most", 0); return; } @@ -1501,7 +1497,7 @@ static void spl_array_method(INTERNAL_FUNCTION_PARAMETERS, char *fname, int fnam aht->u.v.nApplyCount--; } else { if (ZEND_NUM_ARGS() != 1 || zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "z", &arg) == FAILURE) { - zval_ptr_dtor(&tmp); + GC_REFCOUNT(aht) = old_refcount; zend_throw_exception(spl_ce_BadMethodCallException, "Function expects exactly one argument", 0); return; } @@ -1513,9 +1509,9 @@ static void spl_array_method(INTERNAL_FUNCTION_PARAMETERS, char *fname, int fnam if (Z_ISREF(tmp) && Z_TYPE_P(Z_REFVAL(tmp))) { *aht = *Z_ARRVAL_P(Z_REFVAL(tmp)); GC_REMOVE_FROM_BUFFER(Z_ARR_P(Z_REFVAL(tmp))); - efree(Z_ARR_P(Z_REFVAL(tmp))); efree(Z_REF(tmp)); } + GC_REFCOUNT(aht) = old_refcount; if (!Z_ISUNDEF(retval)) { ZVAL_COPY_VALUE(return_value, &retval); } @@ -1749,8 +1745,7 @@ SPL_METHOD(Array, serialize) rebuild_object_properties(&intern->std); } - ZVAL_NEW_ARR(&members); - zend_array_dup(Z_ARRVAL(members), intern->std.properties); + ZVAL_ARR(&members, zend_array_dup(intern->std.properties)); php_var_serialize(&buf, &members, &var_hash); /* finishes the string */ diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index a7d699b635..fd5e08ee66 100644 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -588,9 +588,7 @@ static HashTable *spl_filesystem_object_get_debug_info(zval *object, int *is_tem rebuild_object_properties(&intern->std); } - ALLOC_HASHTABLE(rv); - - zend_array_dup(rv, intern->std.properties); + rv = zend_array_dup(intern->std.properties); pnstr = spl_gen_private_prop_name(spl_ce_SplFileInfo, "pathName", sizeof("pathName")-1); path = spl_filesystem_object_get_pathname(intern, &path_len); diff --git a/ext/spl/spl_observer.c b/ext/spl/spl_observer.c index 9c63b448c6..76457616ea 100644 --- a/ext/spl/spl_observer.c +++ b/ext/spl/spl_observer.c @@ -769,8 +769,7 @@ SPL_METHOD(SplObjectStorage, serialize) /* members */ smart_str_appendl(&buf, "m:", 2); - ZVAL_NEW_ARR(&members); - zend_array_dup(Z_ARRVAL(members), zend_std_get_properties(getThis())); + ZVAL_ARR(&members, zend_array_dup(zend_std_get_properties(getThis()))); php_var_serialize(&buf, &members, &var_hash); /* finishes the string */ zval_ptr_dtor(&members); diff --git a/ext/standard/array.c b/ext/standard/array.c index f0f7d7848b..701e10dff2 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -1459,7 +1459,7 @@ PHP_FUNCTION(extract) var_exists = 0; if (var_name) { - var_exists = zend_hash_exists_ind(&symbol_table->ht, var_name); + var_exists = zend_hash_exists_ind(symbol_table, var_name); } else if (extract_type == EXTR_PREFIX_ALL || extract_type == EXTR_PREFIX_INVALID) { zval num; @@ -1529,18 +1529,18 @@ PHP_FUNCTION(extract) ZVAL_MAKE_REF(entry); Z_ADDREF_P(entry); - if ((orig_var = zend_hash_find(&symbol_table->ht, Z_STR(final_name))) != NULL) { + if ((orig_var = zend_hash_find(symbol_table, Z_STR(final_name))) != NULL) { if (Z_TYPE_P(orig_var) == IS_INDIRECT) { orig_var = Z_INDIRECT_P(orig_var); } zval_ptr_dtor(orig_var); ZVAL_COPY_VALUE(orig_var, entry); } else { - zend_hash_update(&symbol_table->ht, Z_STR(final_name), entry); + zend_hash_update(symbol_table, Z_STR(final_name), entry); } } else { if (Z_REFCOUNTED_P(entry)) Z_ADDREF_P(entry); - zend_hash_update_ind(&symbol_table->ht, Z_STR(final_name), entry); + zend_hash_update_ind(symbol_table, Z_STR(final_name), entry); } count++; } @@ -1604,7 +1604,7 @@ PHP_FUNCTION(compact) } for (i=0; i<ZEND_NUM_ARGS(); i++) { - php_compact_var(&symbol_table->ht, return_value, &args[i]); + php_compact_var(symbol_table, return_value, &args[i]); } } /* }}} */ @@ -2028,7 +2028,7 @@ static void php_splice(HashTable *in_hash, int offset, int length, HashTable *re zend_hash_index_del(in_hash, p->h); } else { zend_hash_add_new(removed, p->key, entry); - if (in_hash == &EG(symbol_table).ht) { + if (in_hash == &EG(symbol_table)) { zend_delete_global_variable(p->key); } else { zend_hash_del(in_hash, p->key); @@ -2045,7 +2045,7 @@ static void php_splice(HashTable *in_hash, int offset, int length, HashTable *re if (p->key == NULL) { zend_hash_index_del(in_hash, p->h); } else { - if (in_hash == &EG(symbol_table).ht) { + if (in_hash == &EG(symbol_table)) { zend_delete_global_variable(p->key); } else { zend_hash_del(in_hash, p->key); @@ -2181,7 +2181,7 @@ PHP_FUNCTION(array_pop) /* Delete the last value */ if (p->key) { - if (Z_ARRVAL_P(stack) == &EG(symbol_table).ht) { + if (Z_ARRVAL_P(stack) == &EG(symbol_table)) { zend_delete_global_variable(p->key); } else { zend_hash_del(Z_ARRVAL_P(stack), p->key); @@ -2238,7 +2238,7 @@ PHP_FUNCTION(array_shift) /* Delete the first value */ if (p->key) { - if (Z_ARRVAL_P(stack) == &EG(symbol_table).ht) { + if (Z_ARRVAL_P(stack) == &EG(symbol_table)) { zend_delete_global_variable(p->key); } else { zend_hash_del(Z_ARRVAL_P(stack), p->key); @@ -3305,8 +3305,7 @@ PHP_FUNCTION(array_unique) php_set_compare_func(sort_type); - ZVAL_NEW_ARR(return_value); - zend_array_dup(Z_ARRVAL_P(return_value), Z_ARRVAL_P(array)); + ZVAL_ARR(return_value, zend_array_dup(Z_ARRVAL_P(array))); if (Z_ARRVAL_P(array)->nNumOfElements <= 1) { /* nothing to do */ return; @@ -3344,7 +3343,7 @@ PHP_FUNCTION(array_unique) if (p->key == NULL) { zend_hash_index_del(Z_ARRVAL_P(return_value), p->h); } else { - if (Z_ARRVAL_P(return_value) == &EG(symbol_table).ht) { + if (Z_ARRVAL_P(return_value) == &EG(symbol_table)) { zend_delete_global_variable(p->key); } else { zend_hash_del(Z_ARRVAL_P(return_value), p->key); @@ -3661,8 +3660,7 @@ static void php_array_intersect(INTERNAL_FUNCTION_PARAMETERS, int behavior, int } /* copy the argument array */ - ZVAL_NEW_ARR(return_value); - zend_array_dup(Z_ARRVAL_P(return_value), Z_ARRVAL(args[0])); + ZVAL_ARR(return_value, zend_array_dup(Z_ARRVAL(args[0]))); /* go through the lists and look for common values */ while (Z_TYPE(ptrs[0]->val) != IS_UNDEF) { @@ -4081,8 +4079,7 @@ static void php_array_diff(INTERNAL_FUNCTION_PARAMETERS, int behavior, int data_ } /* copy the argument array */ - ZVAL_NEW_ARR(return_value); - zend_array_dup(Z_ARRVAL_P(return_value), Z_ARRVAL(args[0])); + ZVAL_ARR(return_value, zend_array_dup(Z_ARRVAL(args[0]))); /* go through the lists and look for values of ptr[0] that are not in the others */ while (Z_TYPE(ptrs[0]->val) != IS_UNDEF) { diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index dcd054fadb..2b70414b12 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -4231,7 +4231,7 @@ PHP_FUNCTION(getopt) * from the symbol table. */ if ((Z_TYPE(PG(http_globals)[TRACK_VARS_SERVER]) == IS_ARRAY || zend_is_auto_global_str(ZEND_STRL("_SERVER"))) && ((args = zend_hash_str_find_ind(HASH_OF(&PG(http_globals)[TRACK_VARS_SERVER]), "argv", sizeof("argv")-1)) != NULL || - (args = zend_hash_str_find_ind(&EG(symbol_table).ht, "argv", sizeof("argv")-1)) != NULL) + (args = zend_hash_str_find_ind(&EG(symbol_table), "argv", sizeof("argv")-1)) != NULL) ) { int pos = 0; zval *entry; diff --git a/ext/standard/browscap.c b/ext/standard/browscap.c index 27856126c3..123a79ea12 100644 --- a/ext/standard/browscap.c +++ b/ext/standard/browscap.c @@ -489,8 +489,7 @@ PHP_FUNCTION(get_browser) } if (return_array) { - ZVAL_NEW_ARR(return_value); - zend_array_dup(Z_ARRVAL_P(return_value), Z_ARRVAL_P(agent)); + ZVAL_ARR(return_value, zend_array_dup(Z_ARRVAL_P(agent))); } else { object_init(return_value); diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c index 454cd04d5b..6e0ea812a4 100644 --- a/ext/standard/http_fopen_wrapper.c +++ b/ext/standard/http_fopen_wrapper.c @@ -669,7 +669,7 @@ finish: zend_set_local_var_str("http_response_header", sizeof("http_response_header")-1, &ztmp, 0); } - response_header = zend_hash_str_find_ind(&symbol_table->ht, "http_response_header", sizeof("http_response_header")-1); + response_header = zend_hash_str_find_ind(symbol_table, "http_response_header", sizeof("http_response_header")-1); if (!php_stream_eof(stream)) { size_t tmp_line_len; diff --git a/ext/standard/info.c b/ext/standard/info.c index eb0a7ca131..943843508f 100644 --- a/ext/standard/info.c +++ b/ext/standard/info.c @@ -204,7 +204,7 @@ static void php_print_gpcse_array(char *name, uint name_length) key = zend_string_init(name, name_length, 0); zend_is_auto_global(key); - if ((data = zend_hash_find(&EG(symbol_table).ht, key)) != NULL && (Z_TYPE_P(data) == IS_ARRAY)) { + if ((data = zend_hash_find(&EG(symbol_table), key)) != NULL && (Z_TYPE_P(data) == IS_ARRAY)) { ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(data), num_key, string_key, tmp) { if (!sapi_module.phpinfo_as_text) { php_info_print("<tr>"); @@ -899,16 +899,16 @@ PHPAPI void php_print_info(int flag) php_info_print_table_start(); php_info_print_table_header(2, "Variable", "Value"); - if ((data = zend_hash_str_find(&EG(symbol_table).ht, "PHP_SELF", sizeof("PHP_SELF")-1)) != NULL && Z_TYPE_P(data) == IS_STRING) { + if ((data = zend_hash_str_find(&EG(symbol_table), "PHP_SELF", sizeof("PHP_SELF")-1)) != NULL && Z_TYPE_P(data) == IS_STRING) { php_info_print_table_row(2, "PHP_SELF", Z_STRVAL_P(data)); } - if ((data = zend_hash_str_find(&EG(symbol_table).ht, "PHP_AUTH_TYPE", sizeof("PHP_AUTH_TYPE")-1)) != NULL && Z_TYPE_P(data) == IS_STRING) { + if ((data = zend_hash_str_find(&EG(symbol_table), "PHP_AUTH_TYPE", sizeof("PHP_AUTH_TYPE")-1)) != NULL && Z_TYPE_P(data) == IS_STRING) { php_info_print_table_row(2, "PHP_AUTH_TYPE", Z_STRVAL_P(data)); } - if ((data = zend_hash_str_find(&EG(symbol_table).ht, "PHP_AUTH_USER", sizeof("PHP_AUTH_USER")-1)) != NULL && Z_TYPE_P(data) == IS_STRING) { + if ((data = zend_hash_str_find(&EG(symbol_table), "PHP_AUTH_USER", sizeof("PHP_AUTH_USER")-1)) != NULL && Z_TYPE_P(data) == IS_STRING) { php_info_print_table_row(2, "PHP_AUTH_USER", Z_STRVAL_P(data)); } - if ((data = zend_hash_str_find(&EG(symbol_table).ht, "PHP_AUTH_PW", sizeof("PHP_AUTH_PW")-1)) != NULL && Z_TYPE_P(data) == IS_STRING) { + if ((data = zend_hash_str_find(&EG(symbol_table), "PHP_AUTH_PW", sizeof("PHP_AUTH_PW")-1)) != NULL && Z_TYPE_P(data) == IS_STRING) { php_info_print_table_row(2, "PHP_AUTH_PW", Z_STRVAL_P(data)); } php_print_gpcse_array(ZEND_STRL("_REQUEST")); diff --git a/ext/wddx/wddx.c b/ext/wddx/wddx.c index 610e1e834f..99b7632119 100644 --- a/ext/wddx/wddx.c +++ b/ext/wddx/wddx.c @@ -667,7 +667,7 @@ static void php_wddx_add_var(wddx_packet *packet, zval *name_var) if (Z_TYPE_P(name_var) == IS_STRING) { zend_array *symbol_table = zend_rebuild_symbol_table(); - if ((val = zend_hash_find(&symbol_table->ht, Z_STR_P(name_var))) != NULL) { + if ((val = zend_hash_find(symbol_table, Z_STR_P(name_var))) != NULL) { if (Z_TYPE_P(val) == IS_INDIRECT) { val = Z_INDIRECT_P(val); } |