diff options
| author | Xinchen Hui <laruence@gmail.com> | 2014-02-25 15:47:24 +0800 |
|---|---|---|
| committer | Xinchen Hui <laruence@gmail.com> | 2014-02-25 15:47:24 +0800 |
| commit | 71dac3d54f8c3dd80d5669846601a6980a7c3067 (patch) | |
| tree | f6ab7ec7d1a2d5a5a83eef9114a548413b3c79c3 /ext | |
| parent | bfcb3defdda99345e42cfa2988f6312fdfc5b7ed (diff) | |
| download | php-git-71dac3d54f8c3dd80d5669846601a6980a7c3067.tar.gz | |
Don't add_ref in add_*_str functions
Diffstat (limited to 'ext')
| -rw-r--r-- | ext/spl/php_spl.c | 10 | ||||
| -rw-r--r-- | ext/standard/array.c | 2 | ||||
| -rw-r--r-- | ext/standard/basic_functions.c | 2 | ||||
| -rw-r--r-- | ext/standard/string.c | 4 |
4 files changed, 8 insertions, 10 deletions
diff --git a/ext/spl/php_spl.c b/ext/spl/php_spl.c index 90d4e2f054..26f39eb513 100644 --- a/ext/spl/php_spl.c +++ b/ext/spl/php_spl.c @@ -744,18 +744,18 @@ PHP_FUNCTION(spl_autoload_functions) Z_ADDREF_P(alfi->obj); add_next_index_zval(&tmp, alfi->obj); } else { - add_next_index_str(&tmp, alfi->ce->name); + add_next_index_str(&tmp, STR_COPY(alfi->ce->name)); } - add_next_index_str(&tmp, alfi->func_ptr->common.function_name); + add_next_index_str(&tmp, STR_COPY(alfi->func_ptr->common.function_name)); add_next_index_zval(return_value, &tmp); } else { if (strncmp(alfi->func_ptr->common.function_name->val, "__lambda_func", sizeof("__lambda_func") - 1)) { - add_next_index_str(return_value, alfi->func_ptr->common.function_name); + add_next_index_str(return_value, STR_COPY(alfi->func_ptr->common.function_name)); } else { zend_string *key; ulong dummy; zend_hash_get_current_key_ex(SPL_G(autoload_functions), &key, &dummy, 0, &function_pos); - add_next_index_str(return_value, key); + add_next_index_str(return_value, STR_COPY(key)); } } @@ -765,7 +765,7 @@ PHP_FUNCTION(spl_autoload_functions) } array_init(return_value); - add_next_index_str(return_value, EG(autoload_func)->common.function_name); + add_next_index_str(return_value, STR_COPY(EG(autoload_func)->common.function_name)); } /* }}} */ /* {{{ proto string spl_object_hash(object obj) diff --git a/ext/standard/array.c b/ext/standard/array.c index ed56b28cf9..69f2fe515b 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -4045,7 +4045,7 @@ PHP_FUNCTION(array_rand) } else { /* Append the result to the return value. */ if (key_type == HASH_KEY_IS_STRING) { - add_next_index_str(return_value, string_key); + add_next_index_str(return_value, STR_COPY(string_key)); } else { add_next_index_long(return_value, num_key); } diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 388042bc79..3f5fb28897 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -4581,7 +4581,6 @@ static int add_config_entry_cb(zval *entry TSRMLS_DC, int num_args, va_list args if (Z_TYPE_P(entry) == IS_STRING) { if (hash_key->key) { -//??? add_assoc_str_ex(retval, hash_key->key->val, hash_key->key->len, STR_COPY(Z_STR_P(entry))); } else { add_index_str(retval, hash_key->h, STR_COPY(Z_STR_P(entry))); @@ -4589,7 +4588,6 @@ static int add_config_entry_cb(zval *entry TSRMLS_DC, int num_args, va_list args } else if (Z_TYPE_P(entry) == IS_ARRAY) { array_init(&tmp); zend_hash_apply_with_arguments(Z_ARRVAL_P(entry) TSRMLS_CC, (apply_func_args_t) add_config_entry_cb, 1, tmp); -//??? add_assoc_zval_ex(retval, hash_key->key->val, hash_key->key->len, &tmp); } return 0; diff --git a/ext/standard/string.c b/ext/standard/string.c index 3c6532d5f4..d484eed022 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -1542,7 +1542,7 @@ PHP_FUNCTION(pathinfo) if (have_basename) { ret = php_basename(path, path_len, NULL, 0 TSRMLS_CC); - add_assoc_str(&tmp, "basename", ret); + add_assoc_str(&tmp, "basename", STR_COPY(ret)); } if ((opt & PHP_PATHINFO_EXTENSION) == PHP_PATHINFO_EXTENSION) { @@ -2537,7 +2537,7 @@ PHP_FUNCTION(substr_replace) result->val[result->len] = '\0'; if (zend_hash_get_current_key_ex(Z_ARRVAL_P(str), &str_index, &num_index, 0, &pos_str) == HASH_KEY_IS_STRING) { - add_assoc_str(return_value, str_index->val, result); + add_assoc_str_ex(return_value, str_index->val, str_index->len, result); } else { add_index_str(return_value, num_index, result); } |
