summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2014-09-19 17:32:50 +0400
committerDmitry Stogov <dmitry@zend.com>2014-09-19 17:32:50 +0400
commitbccc653185d2fe8aa6ff83cf84db56a396c6bc05 (patch)
tree5288aafc3ed4e0542e0cb0a2d90b5bf59df60b1c
parent35f84676877564f3d4ead8f48bc98f72b7b20ff7 (diff)
downloadphp-git-bccc653185d2fe8aa6ff83cf84db56a396c6bc05.tar.gz
Avoid double IS_INTERNED() check
-rw-r--r--Zend/zend.c2
-rw-r--r--Zend/zend_builtin_functions.c8
-rw-r--r--Zend/zend_compile.c18
-rw-r--r--Zend/zend_constants.c2
-rw-r--r--Zend/zend_execute_API.c4
-rw-r--r--Zend/zend_hash.c3
-rw-r--r--Zend/zend_types.h14
-rw-r--r--Zend/zend_vm_def.h15
-rw-r--r--Zend/zend_vm_execute.h21
-rw-r--r--ext/com_dotnet/com_wrapper.c4
-rw-r--r--ext/reflection/php_reflection.c30
-rw-r--r--ext/session/mod_user.c2
-rw-r--r--ext/soap/php_sdl.c3
-rw-r--r--ext/soap/soap.c6
-rw-r--r--ext/spl/spl_functions.c3
-rw-r--r--ext/spl/spl_iterators.c2
-rw-r--r--ext/standard/array.c22
-rw-r--r--ext/standard/assert.c2
-rw-r--r--ext/standard/basic_functions.c2
-rw-r--r--ext/standard/string.c2
-rw-r--r--ext/standard/var_unserializer.c2
-rw-r--r--ext/standard/var_unserializer.re2
-rw-r--r--ext/tokenizer/tokenizer.c2
-rw-r--r--ext/xsl/xsltprocessor.c2
24 files changed, 81 insertions, 92 deletions
diff --git a/Zend/zend.c b/Zend/zend.c
index 78b18dbbc6..f7b6ceb70e 100644
--- a/Zend/zend.c
+++ b/Zend/zend.c
@@ -278,7 +278,7 @@ again:
case IS_REFERENCE:
expr = Z_REFVAL_P(expr);
if (Z_TYPE_P(expr) == IS_STRING) {
- ZVAL_STR(expr_copy, zend_string_copy(Z_STR_P(expr)));
+ ZVAL_STR_COPY(expr_copy, Z_STR_P(expr));
return 1;
}
goto again;
diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c
index 1bb02ef2eb..7885a45528 100644
--- a/Zend/zend_builtin_functions.c
+++ b/Zend/zend_builtin_functions.c
@@ -660,7 +660,7 @@ ZEND_FUNCTION(each)
/* add the key elements */
if (zend_hash_get_current_key(target_hash, &key, &num_key, 0) == HASH_KEY_IS_STRING) {
- ZVAL_STR(&tmp, zend_string_copy(key));
+ ZVAL_STR_COPY(&tmp, key);
if (Z_REFCOUNTED(tmp)) Z_ADDREF(tmp);
} else {
ZVAL_LONG(&tmp, num_key);
@@ -1131,7 +1131,7 @@ ZEND_FUNCTION(get_class_methods)
/* Do not display old-style inherited constructors */
if (!key) {
- ZVAL_STR(&method_name, zend_string_copy(mptr->common.function_name));
+ ZVAL_STR_COPY(&method_name, mptr->common.function_name);
zend_hash_next_index_insert_new(Z_ARRVAL_P(return_value), &method_name);
} else if ((mptr->common.fn_flags & ZEND_ACC_CTOR) == 0 ||
mptr->common.scope == ce ||
@@ -1141,10 +1141,10 @@ ZEND_FUNCTION(get_class_methods)
*mptr->op_array.refcount > 1 &&
(len != key->len ||
!same_name(key->val, mptr->common.function_name->val, len))) {
- ZVAL_STR(&method_name, zend_string_copy(zend_find_alias_name(mptr->common.scope, key)));
+ ZVAL_STR_COPY(&method_name, zend_find_alias_name(mptr->common.scope, key));
zend_hash_next_index_insert_new(Z_ARRVAL_P(return_value), &method_name);
} else {
- ZVAL_STR(&method_name, zend_string_copy(mptr->common.function_name));
+ ZVAL_STR_COPY(&method_name, mptr->common.function_name);
zend_hash_next_index_insert_new(Z_ARRVAL_P(return_value), &method_name);
}
}
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 8748dc0c98..4205a942e0 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -6528,7 +6528,7 @@ static zend_bool zend_try_ct_eval_magic_const(zval *zv, zend_ast *ast TSRMLS_DC)
ZVAL_LONG(zv, CG(zend_lineno));
break;
case T_FILE:
- ZVAL_STR(zv, zend_string_copy(CG(compiled_filename)));
+ ZVAL_STR_COPY(zv, CG(compiled_filename));
break;
case T_DIR:
{
@@ -6551,7 +6551,7 @@ static zend_bool zend_try_ct_eval_magic_const(zval *zv, zend_ast *ast TSRMLS_DC)
}
case T_FUNC_C:
if (op_array && op_array->function_name) {
- ZVAL_STR(zv, zend_string_copy(op_array->function_name));
+ ZVAL_STR_COPY(zv, op_array->function_name);
} else {
ZVAL_EMPTY_STRING(zv);
}
@@ -6562,10 +6562,10 @@ static zend_bool zend_try_ct_eval_magic_const(zval *zv, zend_ast *ast TSRMLS_DC)
ZVAL_NEW_STR(zv, zend_concat3(ce->name->val, ce->name->len, "::", 2,
op_array->function_name->val, op_array->function_name->len));
} else {
- ZVAL_STR(zv, zend_string_copy(ce->name));
+ ZVAL_STR_COPY(zv, ce->name);
}
} else if (op_array && op_array->function_name) {
- ZVAL_STR(zv, zend_string_copy(op_array->function_name));
+ ZVAL_STR_COPY(zv, op_array->function_name);
} else {
ZVAL_EMPTY_STRING(zv);
}
@@ -6575,7 +6575,7 @@ static zend_bool zend_try_ct_eval_magic_const(zval *zv, zend_ast *ast TSRMLS_DC)
if (ZEND_CE_IS_TRAIT(ce)) {
return 0;
} else {
- ZVAL_STR(zv, zend_string_copy(ce->name));
+ ZVAL_STR_COPY(zv, ce->name);
}
} else {
ZVAL_EMPTY_STRING(zv);
@@ -6583,14 +6583,14 @@ static zend_bool zend_try_ct_eval_magic_const(zval *zv, zend_ast *ast TSRMLS_DC)
break;
case T_TRAIT_C:
if (ce && ZEND_CE_IS_TRAIT(ce)) {
- ZVAL_STR(zv, zend_string_copy(ce->name));
+ ZVAL_STR_COPY(zv, ce->name);
} else {
ZVAL_EMPTY_STRING(zv);
}
break;
case T_NS_C:
if (CG(current_namespace)) {
- ZVAL_STR(zv, zend_string_copy(CG(current_namespace)));
+ ZVAL_STR_COPY(zv, CG(current_namespace));
} else {
ZVAL_EMPTY_STRING(zv);
}
@@ -7265,7 +7265,7 @@ void zend_compile_resolve_class_name(znode *result, zend_ast *ast TSRMLS_DC) /*
"Cannot access self::class when no class scope is active");
}
result->op_type = IS_CONST;
- ZVAL_STR(&result->u.constant, zend_string_copy(CG(active_class_entry)->name));
+ ZVAL_STR_COPY(&result->u.constant, CG(active_class_entry)->name);
break;
case ZEND_FETCH_CLASS_STATIC:
case ZEND_FETCH_CLASS_PARENT:
@@ -7469,7 +7469,7 @@ void zend_compile_const_expr_resolve_class_name(zend_ast **ast_ptr TSRMLS_DC) /*
zend_error_noreturn(E_COMPILE_ERROR,
"Cannot access self::class when no class scope is active");
}
- ZVAL_STR(&result, zend_string_copy(CG(active_class_entry)->name));
+ ZVAL_STR_COPY(&result, CG(active_class_entry)->name);
break;
case ZEND_FETCH_CLASS_STATIC:
case ZEND_FETCH_CLASS_PARENT:
diff --git a/Zend/zend_constants.c b/Zend/zend_constants.c
index bca35cf591..164901f898 100644
--- a/Zend/zend_constants.c
+++ b/Zend/zend_constants.c
@@ -246,7 +246,7 @@ static zend_constant *zend_get_special_constant(const char *name, uint name_len
if ((c = zend_hash_find_ptr(EG(zend_constants), const_name)) == NULL) {
c = emalloc(sizeof(zend_constant));
memset(c, 0, sizeof(zend_constant));
- ZVAL_STR(&c->value, zend_string_copy(EG(scope)->name));
+ ZVAL_STR_COPY(&c->value, EG(scope)->name);
zend_hash_add_ptr(EG(zend_constants), const_name, c);
}
zend_string_release(const_name);
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
index 5b3d597112..f59a10179b 100644
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@ -1011,12 +1011,12 @@ ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, const zval *k
if (name->val[0] == '\\') {
ZVAL_STRINGL(&args[0], name->val + 1, name->len - 1);
} else {
- ZVAL_STR(&args[0], zend_string_copy(name));
+ ZVAL_STR_COPY(&args[0], name);
}
fcall_info.size = sizeof(fcall_info);
fcall_info.function_table = EG(function_table);
- ZVAL_STR(&fcall_info.function_name, zend_string_copy(EG(autoload_func)->common.function_name));
+ ZVAL_STR_COPY(&fcall_info.function_name, EG(autoload_func)->common.function_name);
fcall_info.symbol_table = NULL;
fcall_info.retval = &local_retval;
fcall_info.param_count = 1;
diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c
index d541b3168f..6304737f04 100644
--- a/Zend/zend_hash.c
+++ b/Zend/zend_hash.c
@@ -1599,8 +1599,7 @@ ZEND_API void zend_hash_get_current_key_zval_ex(const HashTable *ht, zval *key,
} else {
p = ht->arData + idx;
if (p->key) {
- ZVAL_STR(key, p->key);
- zend_string_addref(p->key);
+ ZVAL_STR_COPY(key, p->key);
} else {
ZVAL_LONG(key, p->h);
}
diff --git a/Zend/zend_types.h b/Zend/zend_types.h
index e23842c679..c654106192 100644
--- a/Zend/zend_types.h
+++ b/Zend/zend_types.h
@@ -537,10 +537,22 @@ static zend_always_inline zend_uchar zval_get_type(const zval* pz) {
zval *__z = (z); \
zend_string *__s = (s); \
Z_STR_P(__z) = __s; \
- /* interned strings support */ \
Z_TYPE_INFO_P(__z) = IS_STRING_EX; \
} while (0)
+#define ZVAL_STR_COPY(z, s) do { \
+ zval *__z = (z); \
+ zend_string *__s = (s); \
+ Z_STR_P(__z) = __s; \
+ /* interned strings support */ \
+ if (IS_INTERNED(__s)) { \
+ Z_TYPE_INFO_P(__z) = IS_INTERNED_STRING_EX; \
+ } else { \
+ GC_REFCOUNT(__s)++; \
+ Z_TYPE_INFO_P(__z) = IS_STRING_EX; \
+ } \
+ } while (0)
+
#define ZVAL_ARR(z, a) do { \
zval *__z = (z); \
Z_ARR_P(__z) = (a); \
diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h
index ac015aea52..b4f8c83f1b 100644
--- a/Zend/zend_vm_def.h
+++ b/Zend/zend_vm_def.h
@@ -3883,8 +3883,7 @@ ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, VAR|CONST|UNUSED, CONST)
ZVAL_DUP(EX_VAR(opline->result.var), value);
} else if (Z_STRLEN_P(opline->op2.zv) == sizeof("class")-1 && memcmp(Z_STRVAL_P(opline->op2.zv), "class", sizeof("class") - 1) == 0) {
/* "class" is assigned as a case-sensitive keyword from zend_do_resolve_class_name */
- ZVAL_STR(EX_VAR(opline->result.var), ce->name);
- zend_string_addref(ce->name);
+ ZVAL_STR_COPY(EX_VAR(opline->result.var), ce->name);
} else {
zend_error_noreturn(E_ERROR, "Undefined class constant '%s'", Z_STRVAL_P(opline->op2.zv));
}
@@ -4716,11 +4715,8 @@ ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY)
if (opline->extended_value & ZEND_FE_FETCH_WITH_KEY) {
if (!p->key) {
ZVAL_LONG(EX_VAR((opline+1)->result.var), p->h);
- } else if (IS_INTERNED(p->key)) {
- ZVAL_INTERNED_STR(EX_VAR((opline+1)->result.var), p->key);
} else {
- ZVAL_NEW_STR(EX_VAR((opline+1)->result.var), p->key);
- GC_REFCOUNT(p->key)++;
+ ZVAL_STR_COPY(EX_VAR((opline+1)->result.var), p->key);
}
}
break;
@@ -4796,12 +4792,7 @@ ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY)
} else if (zend_check_property_access(zobj, p->key TSRMLS_CC) == SUCCESS) {
if (opline->extended_value & ZEND_FE_FETCH_WITH_KEY) {
if (p->key->val[0]) {
- if (IS_INTERNED(p->key)) {
- ZVAL_INTERNED_STR(EX_VAR((opline+1)->result.var), p->key);
- } else {
- ZVAL_NEW_STR(EX_VAR((opline+1)->result.var), p->key);
- GC_REFCOUNT(p->key)++;
- }
+ ZVAL_STR_COPY(EX_VAR((opline+1)->result.var), p->key);
} else {
const char *class_name, *prop_name;
size_t prop_name_len;
diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h
index d2afba6272..d575db0018 100644
--- a/Zend/zend_vm_execute.h
+++ b/Zend/zend_vm_execute.h
@@ -4311,8 +4311,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_CONST_CONST_HANDLER(ZEND_OPCO
ZVAL_DUP(EX_VAR(opline->result.var), value);
} else if (Z_STRLEN_P(opline->op2.zv) == sizeof("class")-1 && memcmp(Z_STRVAL_P(opline->op2.zv), "class", sizeof("class") - 1) == 0) {
/* "class" is assigned as a case-sensitive keyword from zend_do_resolve_class_name */
- ZVAL_STR(EX_VAR(opline->result.var), ce->name);
- zend_string_addref(ce->name);
+ ZVAL_STR_COPY(EX_VAR(opline->result.var), ce->name);
} else {
zend_error_noreturn(E_ERROR, "Undefined class constant '%s'", Z_STRVAL_P(opline->op2.zv));
}
@@ -16676,11 +16675,8 @@ static int ZEND_FASTCALL ZEND_FE_FETCH_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
if (opline->extended_value & ZEND_FE_FETCH_WITH_KEY) {
if (!p->key) {
ZVAL_LONG(EX_VAR((opline+1)->result.var), p->h);
- } else if (IS_INTERNED(p->key)) {
- ZVAL_INTERNED_STR(EX_VAR((opline+1)->result.var), p->key);
} else {
- ZVAL_NEW_STR(EX_VAR((opline+1)->result.var), p->key);
- GC_REFCOUNT(p->key)++;
+ ZVAL_STR_COPY(EX_VAR((opline+1)->result.var), p->key);
}
}
break;
@@ -16756,12 +16752,7 @@ static int ZEND_FASTCALL ZEND_FE_FETCH_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
} else if (zend_check_property_access(zobj, p->key TSRMLS_CC) == SUCCESS) {
if (opline->extended_value & ZEND_FE_FETCH_WITH_KEY) {
if (p->key->val[0]) {
- if (IS_INTERNED(p->key)) {
- ZVAL_INTERNED_STR(EX_VAR((opline+1)->result.var), p->key);
- } else {
- ZVAL_NEW_STR(EX_VAR((opline+1)->result.var), p->key);
- GC_REFCOUNT(p->key)++;
- }
+ ZVAL_STR_COPY(EX_VAR((opline+1)->result.var), p->key);
} else {
const char *class_name, *prop_name;
size_t prop_name_len;
@@ -18714,8 +18705,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE
ZVAL_DUP(EX_VAR(opline->result.var), value);
} else if (Z_STRLEN_P(opline->op2.zv) == sizeof("class")-1 && memcmp(Z_STRVAL_P(opline->op2.zv), "class", sizeof("class") - 1) == 0) {
/* "class" is assigned as a case-sensitive keyword from zend_do_resolve_class_name */
- ZVAL_STR(EX_VAR(opline->result.var), ce->name);
- zend_string_addref(ce->name);
+ ZVAL_STR_COPY(EX_VAR(opline->result.var), ce->name);
} else {
zend_error_noreturn(E_ERROR, "Undefined class constant '%s'", Z_STRVAL_P(opline->op2.zv));
}
@@ -27977,8 +27967,7 @@ static int ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_UNUSED_CONST_HANDLER(ZEND_OPC
ZVAL_DUP(EX_VAR(opline->result.var), value);
} else if (Z_STRLEN_P(opline->op2.zv) == sizeof("class")-1 && memcmp(Z_STRVAL_P(opline->op2.zv), "class", sizeof("class") - 1) == 0) {
/* "class" is assigned as a case-sensitive keyword from zend_do_resolve_class_name */
- ZVAL_STR(EX_VAR(opline->result.var), ce->name);
- zend_string_addref(ce->name);
+ ZVAL_STR_COPY(EX_VAR(opline->result.var), ce->name);
} else {
zend_error_noreturn(E_ERROR, "Undefined class constant '%s'", Z_STRVAL_P(opline->op2.zv));
}
diff --git a/ext/com_dotnet/com_wrapper.c b/ext/com_dotnet/com_wrapper.c
index 409b8f9956..98252eeb24 100644
--- a/ext/com_dotnet/com_wrapper.c
+++ b/ext/com_dotnet/com_wrapper.c
@@ -482,7 +482,7 @@ static void generate_dispids(php_dispatchex *disp TSRMLS_DC)
}
/* add the mappings */
- ZVAL_STR(&tmp2, zend_string_copy(name));
+ ZVAL_STR_COPY(&tmp2, name);
pid = zend_hash_next_free_element(disp->dispid_to_name);
zend_hash_index_update(disp->dispid_to_name, pid, &tmp2);
@@ -517,7 +517,7 @@ static void generate_dispids(php_dispatchex *disp TSRMLS_DC)
}
/* add the mappings */
- ZVAL_STR(&tmp2, zend_string_copy(name));
+ ZVAL_STR_COPY(&tmp2, name);
pid = zend_hash_next_free_element(disp->dispid_to_name);
zend_hash_index_update(disp->dispid_to_name, pid, &tmp2);
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index c2e2610308..7e4f4ab7fb 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -1178,7 +1178,7 @@ PHPAPI void zend_reflection_class_factory(zend_class_entry *ce, zval *object TSR
reflection_object *intern;
zval name;
- ZVAL_STR(&name, zend_string_copy(ce->name));
+ ZVAL_STR_COPY(&name, ce->name);
reflection_instantiate(reflection_class_ptr, object TSRMLS_CC);
intern = Z_REFLECTION_P(object);
intern->ptr = ce;
@@ -1251,7 +1251,7 @@ static void reflection_function_factory(zend_function *function, zval *closure_o
reflection_object *intern;
zval name;
- ZVAL_STR(&name, zend_string_copy(function->common.function_name));
+ ZVAL_STR_COPY(&name, function->common.function_name);
reflection_instantiate(reflection_function_ptr, object TSRMLS_CC);
intern = Z_REFLECTION_P(object);
@@ -1273,9 +1273,9 @@ static void reflection_method_factory(zend_class_entry *ce, zend_function *metho
zval name;
zval classname;
- ZVAL_STR(&name, zend_string_copy((method->common.scope && method->common.scope->trait_aliases)?
- zend_resolve_method_name(ce, method) : method->common.function_name));
- ZVAL_STR(&classname, zend_string_copy(method->common.scope->name));
+ ZVAL_STR_COPY(&name, (method->common.scope && method->common.scope->trait_aliases)?
+ zend_resolve_method_name(ce, method) : method->common.function_name);
+ ZVAL_STR_COPY(&classname, method->common.scope->name);
reflection_instantiate(reflection_method_ptr, object TSRMLS_CC);
intern = Z_REFLECTION_P(object);
intern->ptr = method;
@@ -1320,7 +1320,7 @@ static void reflection_property_factory(zend_class_entry *ce, zend_property_info
}
ZVAL_STRINGL(&name, prop_name, prop_name_len);
- ZVAL_STR(&classname, zend_string_copy(prop->ce->name));
+ ZVAL_STR_COPY(&classname, prop->ce->name);
reflection_instantiate(reflection_property_ptr, object TSRMLS_CC);
intern = Z_REFLECTION_P(object);
@@ -1623,7 +1623,7 @@ ZEND_METHOD(reflection_function, __construct)
return;
}
- ZVAL_STR(&name, zend_string_copy(fptr->common.function_name));
+ ZVAL_STR_COPY(&name, fptr->common.function_name);
reflection_update_property(object, "name", &name);
intern->ptr = fptr;
intern->ref_type = REF_TYPE_FUNCTION;
@@ -2740,9 +2740,9 @@ ZEND_METHOD(reflection_method, __construct)
}
efree(lcname);
- ZVAL_STR(&name, zend_string_copy(mptr->common.scope->name));
+ ZVAL_STR_COPY(&name, mptr->common.scope->name);
reflection_update_property(object, "class", &name);
- ZVAL_STR(&name, zend_string_copy(mptr->common.function_name));
+ ZVAL_STR_COPY(&name, mptr->common.function_name);
reflection_update_property(object, "name", &name);
intern->ptr = mptr;
intern->ref_type = REF_TYPE_FUNCTION;
@@ -3305,7 +3305,7 @@ static void reflection_class_object_ctor(INTERNAL_FUNCTION_PARAMETERS, int is_ob
}
if (Z_TYPE_P(argument) == IS_OBJECT) {
- ZVAL_STR(&classname, zend_string_copy(Z_OBJCE_P(argument)->name));
+ ZVAL_STR_COPY(&classname, Z_OBJCE_P(argument)->name);
reflection_update_property(object, "name", &classname);
intern->ptr = Z_OBJCE_P(argument);
if (is_object) {
@@ -3321,7 +3321,7 @@ static void reflection_class_object_ctor(INTERNAL_FUNCTION_PARAMETERS, int is_ob
return;
}
- ZVAL_STR(&classname, zend_string_copy(ce->name));
+ ZVAL_STR_COPY(&classname, ce->name);
reflection_update_property(object, "name", &classname);
intern->ptr = ce;
@@ -3795,7 +3795,7 @@ ZEND_METHOD(reflection_class, hasProperty)
RETURN_TRUE;
} else {
if (Z_TYPE(intern->obj) != IS_UNDEF && Z_OBJ_HANDLER(intern->obj, has_property)) {
- ZVAL_STR(&property, zend_string_copy(name));
+ ZVAL_STR_COPY(&property, name);
if (Z_OBJ_HANDLER(intern->obj, has_property)(&intern->obj, &property, 2, NULL TSRMLS_CC)) {
zval_ptr_dtor(&property);
RETURN_TRUE;
@@ -4799,10 +4799,10 @@ ZEND_METHOD(reflection_property, __construct)
const char *class_name, *prop_name;
size_t prop_name_len;
zend_unmangle_property_name_ex(property_info->name, &class_name, &prop_name, &prop_name_len);
- ZVAL_STR(&cname, zend_string_copy(property_info->ce->name));
+ ZVAL_STR_COPY(&cname, property_info->ce->name);
ZVAL_STRINGL(&propname, prop_name, prop_name_len);
} else {
- ZVAL_STR(&cname, zend_string_copy(ce->name));
+ ZVAL_STR_COPY(&cname, ce->name);
ZVAL_STRINGL(&propname, name_str, name_len);
}
reflection_update_property(object, "class", &cname);
@@ -5284,7 +5284,7 @@ static int _addinientry(zval *el TSRMLS_DC, int num_args, va_list args, zend_has
if (ini_entry->value) {
zval zv;
- ZVAL_STR(&zv, zend_string_copy(ini_entry->value));
+ ZVAL_STR_COPY(&zv, ini_entry->value);
zend_symtable_update(Z_ARRVAL_P(retval), ini_entry->name, &zv);
} else {
zend_symtable_update(Z_ARRVAL_P(retval), ini_entry->name, &EG(uninitialized_zval));
diff --git a/ext/session/mod_user.c b/ext/session/mod_user.c
index 5d69712543..f42ae15cbf 100644
--- a/ext/session/mod_user.c
+++ b/ext/session/mod_user.c
@@ -44,7 +44,7 @@ ps_module ps_mod_user = {
#define SESS_ZVAL_STR(vl, a) \
{ \
- ZVAL_STR(a, zend_string_copy(vl)); \
+ ZVAL_STR_COPY(a, vl); \
}
static void ps_call_handler(zval *func, int argc, zval *argv, zval *retval TSRMLS_DC)
diff --git a/ext/soap/php_sdl.c b/ext/soap/php_sdl.c
index c7e52dfb8c..d67bea1ab7 100644
--- a/ext/soap/php_sdl.c
+++ b/ext/soap/php_sdl.c
@@ -3288,9 +3288,8 @@ sdlPtr get_sdl(zval *this_ptr, char *uri, zend_long cache_wsdl TSRMLS_DC)
}
smart_str_0(&headers);
- ZVAL_STR(&str_headers, zend_string_copy(headers.s));
+ ZVAL_NEW_STR(&str_headers, headers.s);
php_stream_context_set_option(context, "http", "header", &str_headers);
- smart_str_free(&headers);
zval_ptr_dtor(&str_headers);
}
diff --git a/ext/soap/soap.c b/ext/soap/soap.c
index 554957d512..97a569de30 100644
--- a/ext/soap/soap.c
+++ b/ext/soap/soap.c
@@ -1429,7 +1429,7 @@ PHP_METHOD(SoapServer, addFunction)
return;
}
- ZVAL_STR(&function_copy, zend_string_copy(f->common.function_name));
+ ZVAL_STR_COPY(&function_copy, f->common.function_name);
zend_hash_update(service->soap_functions.ft, key, &function_copy);
zend_string_release(key);
@@ -1452,7 +1452,7 @@ PHP_METHOD(SoapServer, addFunction)
zend_hash_init(service->soap_functions.ft, 0, NULL, ZVAL_PTR_DTOR, 0);
}
- ZVAL_STR(&function_copy, zend_string_copy(f->common.function_name));
+ ZVAL_STR_COPY(&function_copy, f->common.function_name);
zend_hash_update(service->soap_functions.ft, key, &function_copy);
zend_string_release(key);
} else if (Z_TYPE_P(function_name) == IS_LONG) {
@@ -1713,7 +1713,7 @@ PHP_METHOD(SoapServer, handle)
if (zend_hash_str_exists(&Z_OBJCE(tmp_soap)->function_table, php_strtolower(class_name, class_name_len), class_name_len)) {
zval c_ret, constructor;
- ZVAL_STR(&constructor, zend_string_copy(service->soap_class.ce->name));
+ ZVAL_STR_COPY(&constructor, service->soap_class.ce->name);
if (call_user_function(NULL, &tmp_soap, &constructor, &c_ret, service->soap_class.argc, service->soap_class.argv TSRMLS_CC) == FAILURE) {
php_error_docref(NULL TSRMLS_CC, E_ERROR, "Error calling constructor");
}
diff --git a/ext/spl/spl_functions.c b/ext/spl/spl_functions.c
index 13440355ce..4c0d29aa46 100644
--- a/ext/spl/spl_functions.c
+++ b/ext/spl/spl_functions.c
@@ -84,8 +84,7 @@ void spl_add_class_name(zval *list, zend_class_entry *pce, int allow, int ce_fla
if ((tmp = zend_hash_find(Z_ARRVAL_P(list), pce->name)) == NULL) {
zval t;
- zend_string_addref(pce->name);
- ZVAL_STR(&t, pce->name);
+ ZVAL_STR_COPY(&t, pce->name);
zend_hash_add(Z_ARRVAL_P(list), pce->name, &t);
}
}
diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c
index dcc2a8a573..39e5bd512f 100644
--- a/ext/spl/spl_iterators.c
+++ b/ext/spl/spl_iterators.c
@@ -2264,7 +2264,7 @@ SPL_METHOD(RecursiveRegexIterator, getChildren)
zend_call_method_with_0_params(&intern->inner.zobject, intern->inner.ce, NULL, "getchildren", &retval);
if (!EG(exception)) {
- ZVAL_STR(&regex, zend_string_copy(intern->u.regex.regex));
+ ZVAL_STR_COPY(&regex, intern->u.regex.regex);
spl_instantiate_arg_ex2(Z_OBJCE_P(getThis()), return_value, &retval, &regex TSRMLS_CC);
zval_ptr_dtor(&regex);
}
diff --git a/ext/standard/array.c b/ext/standard/array.c
index ecb8603d2c..b6ca16ca7f 100644
--- a/ext/standard/array.c
+++ b/ext/standard/array.c
@@ -706,12 +706,12 @@ static int php_array_user_key_compare(const void *a, const void *b TSRMLS_DC) /*
if (f->key == NULL) {
ZVAL_LONG(&args[0], f->h);
} else {
- ZVAL_STR(&args[0], zend_string_copy(f->key));
+ ZVAL_STR_COPY(&args[0], f->key);
}
if (s->key == NULL) {
ZVAL_LONG(&args[1], s->h);
} else {
- ZVAL_STR(&args[1], zend_string_copy(s->key));
+ ZVAL_STR_COPY(&args[1], s->key);
}
BG(user_compare_fci).param_count = 2;
@@ -1427,7 +1427,7 @@ PHP_FUNCTION(extract)
if (var_exists && var_name->len == sizeof("this")-1 && !strcmp(var_name->val, "this") && EG(scope) && EG(scope)->name->len != 0) {
break;
}
- ZVAL_STR(&final_name, zend_string_copy(var_name));
+ ZVAL_STR_COPY(&final_name, var_name);
break;
case EXTR_PREFIX_IF_EXISTS:
@@ -1438,7 +1438,7 @@ PHP_FUNCTION(extract)
case EXTR_PREFIX_SAME:
if (!var_exists && var_name->len != 0) {
- ZVAL_STR(&final_name, zend_string_copy(var_name));
+ ZVAL_STR_COPY(&final_name, var_name);
}
/* break omitted intentionally */
@@ -1453,14 +1453,14 @@ PHP_FUNCTION(extract)
if (!php_valid_var_name(var_name->val, var_name->len)) {
php_prefix_varname(&final_name, prefix, var_name->val, var_name->len, 1 TSRMLS_CC);
} else {
- ZVAL_STR(&final_name, zend_string_copy(var_name));
+ ZVAL_STR_COPY(&final_name, var_name);
}
}
break;
default:
if (!var_exists) {
- ZVAL_STR(&final_name, zend_string_copy(var_name));
+ ZVAL_STR_COPY(&final_name, var_name);
}
break;
}
@@ -2605,7 +2605,7 @@ PHP_FUNCTION(array_keys)
if (add_key) {
if (str_idx) {
- ZVAL_STR(&new_val, zend_string_copy(str_idx));
+ ZVAL_STR_COPY(&new_val, str_idx);
} else {
ZVAL_LONG(&new_val, num_idx);
}
@@ -2889,14 +2889,14 @@ PHP_FUNCTION(array_flip)
ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(array), num_idx, str_idx, entry) {
if (Z_TYPE_P(entry) == IS_LONG) {
if (str_idx) {
- ZVAL_STR(&data, zend_string_copy(str_idx));
+ ZVAL_STR_COPY(&data, str_idx);
} else {
ZVAL_LONG(&data, num_idx);
}
zend_hash_index_update(Z_ARRVAL_P(return_value), Z_LVAL_P(entry), &data);
} else if (Z_TYPE_P(entry) == IS_STRING) {
if (str_idx) {
- ZVAL_STR(&data, zend_string_copy(str_idx));
+ ZVAL_STR_COPY(&data, str_idx);
} else {
ZVAL_LONG(&data, num_idx);
}
@@ -4366,9 +4366,9 @@ PHP_FUNCTION(array_filter)
}
} else {
if (use_type == ARRAY_FILTER_USE_BOTH) {
- ZVAL_STR(&args[1], zend_string_copy(string_key));
+ ZVAL_STR_COPY(&args[1], string_key);
} else if (use_type == ARRAY_FILTER_USE_KEY) {
- ZVAL_STR(&args[0], zend_string_copy(string_key));
+ ZVAL_STR_COPY(&args[0], string_key);
}
}
}
diff --git a/ext/standard/assert.c b/ext/standard/assert.c
index 94fee5a1ce..1537022538 100644
--- a/ext/standard/assert.c
+++ b/ext/standard/assert.c
@@ -59,7 +59,7 @@ static PHP_INI_MH(OnChangeCallback) /* {{{ */
ZVAL_UNDEF(&ASSERTG(callback));
}
if (new_value && (Z_TYPE(ASSERTG(callback)) != IS_UNDEF || new_value->len)) {
- ZVAL_STR(&ASSERTG(callback), zend_string_copy(new_value));
+ ZVAL_STR_COPY(&ASSERTG(callback), new_value);
}
} else {
if (ASSERTG(cb)) {
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index 53aec268b0..f6ad7dbdd7 100644
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -5261,7 +5261,7 @@ static int php_ini_get_option(zval *zv TSRMLS_DC, int num_args, va_list args, ze
if (ini_entry->value) {
zval zv;
- ZVAL_STR(&zv, zend_string_copy(ini_entry->value));
+ ZVAL_STR_COPY(&zv, ini_entry->value);
zend_symtable_update(Z_ARRVAL_P(ini_array), ini_entry->name, &zv);
} else {
zend_symtable_update(Z_ARRVAL_P(ini_array), ini_entry->name, &EG(uninitialized_zval));
diff --git a/ext/standard/string.c b/ext/standard/string.c
index fec8b70934..a5041afee3 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -2559,7 +2559,7 @@ PHP_FUNCTION(substr_replace)
if (str_index) {
zval tmp;
- ZVAL_STR(&tmp, result);
+ ZVAL_NEW_STR(&tmp, result);
zend_symtable_update(Z_ARRVAL_P(return_value), str_index, &tmp);
} else {
add_index_str(return_value, num_index, result);
diff --git a/ext/standard/var_unserializer.c b/ext/standard/var_unserializer.c
index 7e6789daaa..20d6260228 100644
--- a/ext/standard/var_unserializer.c
+++ b/ext/standard/var_unserializer.c
@@ -700,7 +700,7 @@ yy20:
/* Call unserialize callback */
ZVAL_STRING(&user_func, PG(unserialize_callback_func));
- ZVAL_STR(&args[0], zend_string_copy(class_name));
+ ZVAL_STR_COPY(&args[0], class_name);
BG(serialize_lock)++;
if (call_user_function_ex(CG(function_table), NULL, &user_func, &retval, 1, args, 0, NULL TSRMLS_CC) != SUCCESS) {
BG(serialize_lock)--;
diff --git a/ext/standard/var_unserializer.re b/ext/standard/var_unserializer.re
index 39161353f8..7924022263 100644
--- a/ext/standard/var_unserializer.re
+++ b/ext/standard/var_unserializer.re
@@ -755,7 +755,7 @@ object ":" uiv ":" ["] {
/* Call unserialize callback */
ZVAL_STRING(&user_func, PG(unserialize_callback_func));
- ZVAL_STR(&args[0], zend_string_copy(class_name));
+ ZVAL_STR_COPY(&args[0], class_name);
BG(serialize_lock)++;
if (call_user_function_ex(CG(function_table), NULL, &user_func, &retval, 1, args, 0, NULL TSRMLS_CC) != SUCCESS) {
BG(serialize_lock)--;
diff --git a/ext/tokenizer/tokenizer.c b/ext/tokenizer/tokenizer.c
index 1847b0537d..80ab5a81d8 100644
--- a/ext/tokenizer/tokenizer.c
+++ b/ext/tokenizer/tokenizer.c
@@ -185,7 +185,7 @@ PHP_FUNCTION(token_get_all)
return;
}
- ZVAL_STR(&source_zval, zend_string_copy(source));
+ ZVAL_STR_COPY(&source_zval, source);
zend_save_lexical_state(&original_lex_state TSRMLS_CC);
if (zend_prepare_string_for_scanning(&source_zval, "" TSRMLS_CC) == FAILURE) {
diff --git a/ext/xsl/xsltprocessor.c b/ext/xsl/xsltprocessor.c
index cd828c75a0..6c53f39a6d 100644
--- a/ext/xsl/xsltprocessor.c
+++ b/ext/xsl/xsltprocessor.c
@@ -791,7 +791,7 @@ PHP_FUNCTION(xsl_xsltprocessor_set_parameter)
intern = Z_XSL_P(id);
- ZVAL_STR(&new_string, zend_string_copy(value));
+ ZVAL_STR_COPY(&new_string, value);
zend_hash_update(intern->parameter, name, &new_string);
RETURN_TRUE;