zval *ret, tmp;
ZVAL_STR(&tmp, str);
- STR_ADDREF(str);
ret = zend_symtable_str_update(Z_ARRVAL_P(arg), key, key_len, &tmp);
return ret ? SUCCESS : FAILURE;
}
{
zval tmp;
- ZVAL_STR(&tmp, STR_COPY(str));
+ ZVAL_STR(&tmp, str);
return zend_hash_next_index_insert(Z_ARRVAL_P(arg), &tmp) ? SUCCESS : FAILURE;
}
/* }}} */
zval tmp;
//??? ZVAL_STRING(tmp, str, duplicate);
- ZVAL_STR(&tmp, STR_COPY(str));
+ ZVAL_STR(&tmp, str);
return zend_hash_index_update(Z_ARRVAL_P(arg), index, &tmp);
}
/* }}} */
if (Z_TYPE_P(callable) == IS_STRING && fcc.calling_scope) {
zval_dtor(callable);
array_init(callable);
- add_next_index_str(callable, fcc.calling_scope->name);
- add_next_index_str(callable, fcc.function_handler->common.function_name);
+ add_next_index_str(callable, STR_COPY(fcc.calling_scope->name));
+ add_next_index_str(callable, STR_COPY(fcc.function_handler->common.function_name));
}
if (fcc.function_handler &&
((fcc.function_handler->type == ZEND_INTERNAL_FUNCTION &&
/* add the key elements */
switch (zend_hash_get_current_key_ex(target_hash, &key, &num_key, 0, NULL)) {
case HASH_KEY_IS_STRING:
- inserted_pointer = add_get_index_str(return_value, 0, key);
+ inserted_pointer = add_get_index_str(return_value, 0, STR_COPY(key));
break;
case HASH_KEY_IS_LONG:
inserted_pointer = add_get_index_long(return_value, 0, num_key);
array_init(return_value);
zend_hash_internal_pointer_reset(&EG(included_files));
while (zend_hash_get_current_key_ex(&EG(included_files), &entry, NULL, 0, NULL) == HASH_KEY_IS_STRING) {
- add_next_index_str(return_value, entry);
+ add_next_index_str(return_value, STR_COPY(entry));
zend_hash_move_forward(&EG(included_files));
}
}
if (ce->refcount > 1 &&
(ce->name->len != hash_key->key->len - 1 ||
!same_name(hash_key->key->val, ce->name->val, ce->name->len))) {
- add_next_index_str(array, hash_key->key);
+ add_next_index_str(array, STR_COPY(hash_key->key));
} else {
- add_next_index_str(array, ce->name);
+ add_next_index_str(array, STR_COPY(ce->name));
}
}
return ZEND_HASH_APPLY_KEEP;
}
if (func->type == ZEND_INTERNAL_FUNCTION) {
- add_next_index_str(internal_ar, hash_key->key);
+ add_next_index_str(internal_ar, STR_COPY(hash_key->key));
} else if (func->type == ZEND_USER_FUNCTION) {
- add_next_index_str(user_ar, hash_key->key);
+ add_next_index_str(user_ar, STR_COPY(hash_key->key));
}
return 0;
break;
}
if (prev->op_array) {
- add_assoc_str_ex(&stack_frame, "file", sizeof("file")-1, prev->op_array->filename);
+ add_assoc_str_ex(&stack_frame, "file", sizeof("file")-1, STR_COPY(prev->op_array->filename));
add_assoc_long_ex(&stack_frame, "line", sizeof("line")-1, prev->opline->lineno);
break;
}
if (Z_TYPE(ptr->object) == IS_OBJECT) {
if (ptr->function_state.function->common.scope) {
- add_assoc_str_ex(&stack_frame, "class", sizeof("class")-1, ptr->function_state.function->common.scope->name);
+ add_assoc_str_ex(&stack_frame, "class", sizeof("class")-1, STR_COPY(ptr->function_state.function->common.scope->name));
} else {
class_name = zend_get_object_classname(&ptr->object TSRMLS_CC);
- add_assoc_str_ex(&stack_frame, "class", sizeof("class")-1, class_name);
+ add_assoc_str_ex(&stack_frame, "class", sizeof("class")-1, STR_COPY(class_name));
}
if ((options & DEBUG_BACKTRACE_PROVIDE_OBJECT) != 0) {
add_assoc_string_ex(&stack_frame, "type", sizeof("type")-1, "->", 1);
} else if (ptr->function_state.function->common.scope) {
- add_assoc_str_ex(&stack_frame, "class", sizeof("class")-1, ptr->function_state.function->common.scope->name);
+ add_assoc_str_ex(&stack_frame, "class", sizeof("class")-1, STR_COPY(ptr->function_state.function->common.scope->name));
add_assoc_string_ex(&stack_frame, "type", sizeof("type")-1, "::", 1);
}
array_init(return_value);
array = 1;
}
- add_next_index_str(return_value, zif->common.function_name);
+ add_next_index_str(return_value, STR_COPY(zif->common.function_name));
}
zend_hash_move_forward_ex(CG(function_table), &iterator);
}
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));
}
}
}
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)
} 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);
}
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)));
} 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;
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) {
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);
}