zval_dtor() doesn't make a lot of sense in PHP-7.* and it's used incorrectly in some places.
Its occurances should be replaced by zval_ptr_dtor() or zval_ptr_dtor_nogc(), or even more specialized destructors.
if (zend_is_callable_ex(callable, NULL, IS_CALLABLE_STRICT, callable_name, &fcc, NULL)) {
if (Z_TYPE_P(callable) == IS_STRING && fcc.calling_scope) {
- zval_dtor(callable);
+ zval_ptr_dtor_str(callable);
array_init(callable);
add_next_index_str(callable, zend_string_copy(fcc.calling_scope->name));
add_next_index_str(callable, zend_string_copy(fcc.function_handler->common.function_name));
if (!zend_hash_next_index_insert(Z_ARRVAL_P(result), expr)) {
zend_error(E_WARNING,
"Cannot add element to the array as the next element is already occupied");
- zval_ptr_dtor(expr);
+ zval_ptr_dtor_nogc(expr);
}
break;
case IS_STRING:
zend_symtable_update(Z_ARRVAL_P(result), Z_STR_P(offset), expr);
- zval_dtor(offset);
+ zval_ptr_dtor_str(offset);
break;
case IS_NULL:
zend_symtable_update(Z_ARRVAL_P(result), ZSTR_EMPTY_ALLOC(), expr);
if (UNEXPECTED(zend_ast_evaluate(&op1, ast->child[0], scope) != SUCCESS)) {
ret = FAILURE;
} else if (UNEXPECTED(zend_ast_evaluate(&op2, ast->child[1], scope) != SUCCESS)) {
- zval_dtor(&op1);
+ zval_ptr_dtor_nogc(&op1);
ret = FAILURE;
} else {
binary_op_type op = get_binary_op(ast->attr);
ret = op(result, &op1, &op2);
- zval_dtor(&op1);
- zval_dtor(&op2);
+ zval_ptr_dtor_nogc(&op1);
+ zval_ptr_dtor_nogc(&op2);
}
break;
case ZEND_AST_GREATER:
if (UNEXPECTED(zend_ast_evaluate(&op1, ast->child[0], scope) != SUCCESS)) {
ret = FAILURE;
} else if (UNEXPECTED(zend_ast_evaluate(&op2, ast->child[1], scope) != SUCCESS)) {
- zval_dtor(&op1);
+ zval_ptr_dtor_nogc(&op1);
ret = FAILURE;
} else {
/* op1 > op2 is the same as op2 < op1 */
binary_op_type op = ast->kind == ZEND_AST_GREATER
? is_smaller_function : is_smaller_or_equal_function;
ret = op(result, &op2, &op1);
- zval_dtor(&op1);
- zval_dtor(&op2);
+ zval_ptr_dtor_nogc(&op1);
+ zval_ptr_dtor_nogc(&op2);
}
break;
case ZEND_AST_UNARY_OP:
} else {
unary_op_type op = get_unary_op(ast->attr);
ret = op(result, &op1);
- zval_dtor(&op1);
+ zval_ptr_dtor_nogc(&op1);
}
break;
case ZEND_AST_ZVAL:
}
if (zend_is_true(&op1)) {
if (UNEXPECTED(zend_ast_evaluate(&op2, ast->child[1], scope) != SUCCESS)) {
- zval_dtor(&op1);
+ zval_ptr_dtor_nogc(&op1);
ret = FAILURE;
break;
}
ZVAL_BOOL(result, zend_is_true(&op2));
- zval_dtor(&op2);
+ zval_ptr_dtor_nogc(&op2);
} else {
ZVAL_FALSE(result);
}
- zval_dtor(&op1);
+ zval_ptr_dtor_nogc(&op1);
break;
case ZEND_AST_OR:
if (UNEXPECTED(zend_ast_evaluate(&op1, ast->child[0], scope) != SUCCESS)) {
ZVAL_TRUE(result);
} else {
if (UNEXPECTED(zend_ast_evaluate(&op2, ast->child[1], scope) != SUCCESS)) {
- zval_dtor(&op1);
+ zval_ptr_dtor_nogc(&op1);
ret = FAILURE;
break;
}
ZVAL_BOOL(result, zend_is_true(&op2));
- zval_dtor(&op2);
+ zval_ptr_dtor_nogc(&op2);
}
- zval_dtor(&op1);
+ zval_ptr_dtor_nogc(&op1);
break;
case ZEND_AST_CONDITIONAL:
if (UNEXPECTED(zend_ast_evaluate(&op1, ast->child[0], scope) != SUCCESS)) {
*result = op1;
} else {
if (UNEXPECTED(zend_ast_evaluate(result, ast->child[1], scope) != SUCCESS)) {
- zval_dtor(&op1);
+ zval_ptr_dtor_nogc(&op1);
ret = FAILURE;
break;
}
- zval_dtor(&op1);
+ zval_ptr_dtor_nogc(&op1);
}
} else {
if (UNEXPECTED(zend_ast_evaluate(result, ast->child[2], scope) != SUCCESS)) {
- zval_dtor(&op1);
+ zval_ptr_dtor_nogc(&op1);
ret = FAILURE;
break;
}
- zval_dtor(&op1);
+ zval_ptr_dtor_nogc(&op1);
}
break;
case ZEND_AST_COALESCE:
*result = op1;
} else {
if (UNEXPECTED(zend_ast_evaluate(result, ast->child[1], scope) != SUCCESS)) {
- zval_dtor(&op1);
+ zval_ptr_dtor_nogc(&op1);
ret = FAILURE;
break;
}
- zval_dtor(&op1);
+ zval_ptr_dtor_nogc(&op1);
}
break;
case ZEND_AST_UNARY_PLUS:
} else {
ZVAL_LONG(&op1, 0);
ret = add_function(result, &op1, &op2);
- zval_dtor(&op2);
+ zval_ptr_dtor_nogc(&op2);
}
break;
case ZEND_AST_UNARY_MINUS:
} else {
ZVAL_LONG(&op1, 0);
ret = sub_function(result, &op1, &op2);
- zval_dtor(&op2);
+ zval_ptr_dtor_nogc(&op2);
}
break;
case ZEND_AST_ARRAY:
zend_ast *elem = list->child[i];
if (elem->child[1]) {
if (UNEXPECTED(zend_ast_evaluate(&op1, elem->child[1], scope) != SUCCESS)) {
- zval_dtor(result);
+ zval_ptr_dtor_nogc(result);
return FAILURE;
}
} else {
ZVAL_UNDEF(&op1);
}
if (UNEXPECTED(zend_ast_evaluate(&op2, elem->child[0], scope) != SUCCESS)) {
- zval_dtor(&op1);
- zval_dtor(result);
+ zval_ptr_dtor_nogc(&op1);
+ zval_ptr_dtor_nogc(result);
return FAILURE;
}
if (UNEXPECTED(zend_ast_add_array_element(result, &op1, &op2) != SUCCESS)) {
- zval_dtor(&op1);
- zval_dtor(&op2);
- zval_dtor(result);
+ zval_ptr_dtor_nogc(&op1);
+ zval_ptr_dtor_nogc(&op2);
+ zval_ptr_dtor_nogc(result);
return FAILURE;
}
}
if (UNEXPECTED(zend_ast_evaluate(&op1, ast->child[0], scope) != SUCCESS)) {
ret = FAILURE;
} else if (UNEXPECTED(zend_ast_evaluate(&op2, ast->child[1], scope) != SUCCESS)) {
- zval_dtor(&op1);
+ zval_ptr_dtor_nogc(&op1);
ret = FAILURE;
} else {
zend_fetch_dimension_const(result, &op1, &op2, (ast->attr == ZEND_DIM_IS) ? BP_VAR_IS : BP_VAR_R);
- zval_dtor(&op1);
- zval_dtor(&op2);
+ zval_ptr_dtor_nogc(&op1);
+ zval_ptr_dtor_nogc(&op2);
}
break;
default:
void zend_del_literal(zend_op_array *op_array, int n) /* {{{ */
{
- zval_dtor(CT_CONSTANT_EX(op_array, n));
+ zval_ptr_dtor_nogc(CT_CONSTANT_EX(op_array, n));
if (n + 1 == op_array->last_literal) {
op_array->last_literal--;
} else {
if (arg_node.op_type == IS_CONST && Z_TYPE(arg_node.u.constant) == IS_STRING) {
result->op_type = IS_CONST;
ZVAL_LONG(&result->u.constant, Z_STRLEN(arg_node.u.constant));
- zval_dtor(&arg_node.u.constant);
+ zval_ptr_dtor_str(&arg_node.u.constant);
} else {
zend_emit_op_tmp(result, ZEND_STRLEN, &arg_node, NULL);
}
zend_error_noreturn(E_COMPILE_ERROR, "'goto' to undefined label '%s'", Z_STRVAL_P(label));
}
- zval_dtor(label);
+ zval_ptr_dtor_str(label);
ZVAL_NULL(label);
current = opline->extended_value;
opline->opcode = ZEND_FREE;
SET_NODE(opline->op1, &expr_node);
} else if (expr_node.op_type == IS_CONST) {
- zval_dtor(&expr_node.u.constant);
+ zval_ptr_dtor_nogc(&expr_node.u.constant);
}
efree(jmpnz_opnums);
zval value_zv;
zend_const_expr_to_zval(&value_zv, value_ast);
FC(declarables).ticks = zval_get_long(&value_zv);
- zval_dtor(&value_zv);
+ zval_ptr_dtor_nogc(&value_zv);
} else if (zend_string_equals_literal_ci(name, "encoding")) {
if (FAILURE == zend_declare_is_first_statement(ast)) {
zend_constant *c = Z_PTR_P(zv);
if (!(c->flags & CONST_PERSISTENT)) {
- zval_ptr_dtor(&c->value);
+ zval_ptr_dtor_nogc(&c->value);
if (c->name) {
zend_string_release_ex(c->name, 0);
}
zend_error(E_NOTICE,"Constant %s already defined", ZSTR_VAL(name));
zend_string_release(c->name);
if (!(c->flags & CONST_PERSISTENT)) {
- zval_dtor(&c->value);
+ zval_ptr_dtor_nogc(&c->value);
}
ret = FAILURE;
}
zend_exception_restore();
zval_ptr_dtor(&args[0]);
- zval_dtor(&fcall_info.function_name);
+ zval_ptr_dtor_str(&fcall_info.function_name);
zend_hash_del(EG(in_autoload), lc_name);
} else {
retval = FAILURE;
}
- zval_dtor(&pv);
+ zval_ptr_dtor_str(&pv);
return retval;
}
/* }}} */
return 1;
error:
- zval_dtor(zendlval);
+ zval_ptr_dtor_str(zendlval);
ZVAL_UNDEF(zendlval);
return 0;
ZVAL_UNDEF(&zv);
retval = lex_scan(&zv, NULL);
- zval_dtor(&zv);
+ zval_ptr_dtor_nogc(&zv);
if (EG(exception)) {
zend_clear_exception();
return 1;
error:
- zval_dtor(zendlval);
+ zval_ptr_dtor_str(zendlval);
ZVAL_UNDEF(zendlval);
return 0;
ZVAL_UNDEF(&zv);
retval = lex_scan(&zv, NULL);
- zval_dtor(&zv);
+ zval_ptr_dtor_nogc(&zv);
if (EG(exception)) {
zend_clear_exception();
if (!obj->initialized) {
retval = zend_std_has_property(object, member, type, cache_slot);
if (member == &tmp_member) {
- zval_dtor(member);
+ zval_ptr_dtor_str(&tmp_member);
}
return retval;
}
}
if (member == &tmp_member) {
- zval_dtor(member);
+ zval_ptr_dtor_str(&tmp_member);
}
return retval;
if (!obj->initialized) {
retval = zend_std_read_property(object, member, type, cache_slot, rv);
if (member == &tmp_member) {
- zval_dtor(member);
+ zval_ptr_dtor_str(&tmp_member);
}
return retval;
}
retval = zend_std_read_property(object, member, type, cache_slot, rv);
if (member == &tmp_member) {
- zval_dtor(member);
+ zval_ptr_dtor_str(&tmp_member);
}
return retval;
}
if (member == &tmp_member) {
- zval_dtor(member);
+ zval_ptr_dtor_str(&tmp_member);
}
return retval;
if (!obj->initialized) {
zend_std_write_property(object, member, value, cache_slot);
if (member == &tmp_member) {
- zval_dtor(member);
+ zval_ptr_dtor_str(&tmp_member);
}
return;
}
} while(0);
if (member == &tmp_member) {
- zval_dtor(member);
+ zval_ptr_dtor_str(&tmp_member);
}
}
/* }}} */
}
if (member == &tmp_member) {
- zval_dtor(member);
+ zval_ptr_dtor_str(&tmp_member);
}
return ret;
}
}
zend_string_release_ex(callable, 0);
- zval_dtor(&fci.function_name);
+ zval_ptr_dtor_str(&fci.function_name);
if (fci.param_count > 0) {
for (i = 0; i < nargs - 1; i++) {
zval_ptr_dtor(&fci.params[i]);
gmp_strval(&zv, gmpnum, 10);
php_var_serialize(&buf, &zv, &serialize_data);
- zval_dtor(&zv);
+ zval_ptr_dtor_str(&zv);
ZVAL_ARR(&zv, zend_std_get_properties(object));
php_var_serialize(&buf, &zv, &serialize_data);
if (err != PHP_ICONV_ERR_SUCCESS) {
_php_iconv_show_error(err, charset, "???");
- zval_dtor(return_value);
+ zend_array_destroy(Z_ARR_P(return_value));
RETVAL_FALSE;
}
}
mail_parameters(NIL, SET_QUOTA, (void *) mail_getquota);
if (!imap_getquota(imap_le_struct->imap_stream, ZSTR_VAL(qroot))) {
php_error_docref(NULL, E_WARNING, "c-client imap_getquota failed");
- zval_dtor(return_value);
+ zend_array_destroy(Z_ARR_P(return_value));
RETURN_FALSE;
}
}
mail_parameters(NIL, SET_QUOTA, (void *) mail_getquota);
if (!imap_getquotaroot(imap_le_struct->imap_stream, ZSTR_VAL(mbox))) {
php_error_docref(NULL, E_WARNING, "c-client imap_getquotaroot failed");
- zval_dtor(return_value);
+ zend_array_destroy(Z_ARR_P(return_value));
RETURN_FALSE;
}
}
mail_parameters(NIL, SET_ACL, (void *) mail_getacl);
if (!imap_getacl(imap_le_struct->imap_stream, ZSTR_VAL(mailbox))) {
php_error(E_WARNING, "c-client imap_getacl failed");
- zval_dtor(return_value);
+ zend_array_destroy(Z_ARR_P(return_value));
RETURN_FALSE;
}
}
if (decode == NULL) {
efree(charset);
- zval_dtor(return_value);
+ zend_array_destroy(Z_ARR_P(return_value));
RETURN_FALSE;
}
object_init(&myobject);
}
}
- zval_dtor(&callback);
+ zval_ptr_dtor_str(&callback);
/* return whatever type we got back from the callback: let DB handle conversion */
switch (Z_TYPE(return_value)) {
php_error( E_WARNING, "Error casting object to string in collator_convert_object_to_string()" );
/* Cleanup zstr to hold utf16 string. */
- zval_dtor( zstr );
+ zval_ptr_dtor_str( zstr );
/* Set string. */
ZVAL_STRINGL( zstr, (char*)ustr, UBYTES(ustr_len));
if( use_copy )
{
str = collator_convert_zstr_utf8_to_utf16( &arg_copy, rv );
- zval_dtor( &arg_copy );
+ zval_ptr_dtor_str( &arg_copy );
}
else
{
alias = ucnv_getAlias(name, i, &error);
if (U_FAILURE(error)) {
THROW_UFAILURE(NULL, "ucnv_getAlias", error);
- zval_dtor(return_value);
+ zend_array_destroy(Z_ARR_P(return_value));
RETURN_NULL();
}
add_next_index_string(return_value, alias);
const char *name = ucnv_getStandard(i, &error);
if (U_FAILURE(error)) {
THROW_UFAILURE(NULL, "ucnv_getStandard", error);
- zval_dtor(return_value);
+ zend_array_destroy(Z_ARR_P(return_value));
RETURN_NULL();
}
add_next_index_string(return_value, name);
if( kw_value_str){
zend_string_efree( kw_value_str );
}
- zval_dtor(return_value);
+ zend_array_destroy(Z_ARR_P(return_value));
RETURN_FALSE;
}
intl_errors_set(outside_error, U_ILLEGAL_ARGUMENT_ERROR, message, 1);
efree(message);
}
- zval_dtor(&local_zv_tz);
+ zval_ptr_dtor_str(&local_zv_tz);
return NULL;
}
timeZone = to->utimezone->clone();
intl_errors_set(outside_error, U_MEMORY_ALLOCATION_ERROR, message, 1);
efree(message);
}
- zval_dtor(&local_zv_tz);
+ zval_ptr_dtor_str(&local_zv_tz);
return NULL;
}
} else if (Z_TYPE_P(zv_timezone) == IS_OBJECT &&
php_timezone_obj *tzobj = Z_PHPTIMEZONE_P(zv_timezone);
- zval_dtor(&local_zv_tz);
+ zval_ptr_dtor_str(&local_zv_tz);
return timezone_convert_datetimezone(tzobj->type, tzobj, 0,
outside_error, func);
} else {
intl_errors_set(outside_error, status, message, 1);
efree(message);
}
- zval_dtor(&local_zv_tz);
+ zval_ptr_dtor_str(&local_zv_tz);
return NULL;
}
timeZone = TimeZone::createTimeZone(id);
intl_errors_set(outside_error, U_MEMORY_ALLOCATION_ERROR, message, 1);
efree(message);
}
- zval_dtor(&local_zv_tz);
+ zval_ptr_dtor_str(&local_zv_tz);
return NULL;
}
if (timeZone->getID(gottenId) != id) {
intl_errors_set(outside_error, U_ILLEGAL_ARGUMENT_ERROR, message, 1);
efree(message);
}
- zval_dtor(&local_zv_tz);
+ zval_ptr_dtor_str(&local_zv_tz);
delete timeZone;
return NULL;
}
}
- zval_dtor(&local_zv_tz);
+ zval_ptr_dtor_str(&local_zv_tz);
return timeZone;
}
#define TRANSLITERATOR_PROPERTY_HANDLER_EPILOG \
if( member == &tmp_member ) \
{ \
- zval_dtor( &tmp_member ); \
+ zval_ptr_dtor_str( &tmp_member ); \
}
/* {{{ get_property_ptr_ptr handler */
intl_error_set_code( NULL, status );
if( U_FAILURE( status ) )
{
- zval_dtor( return_value );
+ zend_array_destroy( Z_ARR_P(return_value) );
RETVAL_FALSE;
intl_error_set_custom_msg( NULL, "transliterator_list_ids: "
"Failed to build array of registered transliterators", 0 );
ldap_result_entry = ldap_first_entry(ldap, ldap_result);
if (ldap_result_entry == NULL) {
- zval_dtor(return_value);
+ zend_array_destroy(Z_ARR_P(return_value));
RETURN_FALSE;
}
smart_str_appendl(&out_buf, Z_STRVAL(v), Z_STRLEN(v));
/* Clean up */
smart_str_free(&eval_buf);
- zval_dtor(&v);
+ zval_ptr_dtor_str(&v);
} else if (is_callable) {
zval args[1];
zval subpats, retval;
OnigUChar err_str[ONIG_MAX_ERROR_MESSAGE_LEN];
onig_error_code_to_str(err_str, err);
php_error_docref(NULL, E_WARNING, "mbregex search failure in mbsplit(): %s", err_str);
- zval_dtor(return_value);
+ zend_array_destroy(Z_ARR_P(return_value));
RETURN_FALSE;
}
}
if (member == &tmp_member) {
- zval_dtor(member);
+ zval_ptr_dtor_str(&tmp_member);
}
return retval;
}
if (member == &tmp_member) {
- zval_dtor(member);
+ zval_ptr_dtor_str(&tmp_member);
}
}
/* }}} */
array_init_size(return_value, mysqlnd_num_fields(result) * 2);
if (FAIL == result->m.fetch_row(result, (void *)return_value, flags, &fetched_anything)) {
php_error_docref(NULL, E_WARNING, "Error while reading a row");
- zval_dtor(return_value);
+ zend_array_destroy(Z_ARR_P(return_value));
RETVAL_FALSE;
} else if (fetched_anything == FALSE) {
- zval_dtor(return_value);
+ zend_array_destroy(Z_ARR_P(return_value));
switch (extension) {
case MYSQLND_MYSQLI:
RETVAL_NULL();
#define TMP_CLEAN \
if (Z_TYPE(tmp) == IS_STRING) {\
- zval_dtor(&tmp); \
+ zval_ptr_dtor_str(&tmp); \
} \
return NULL;
TMP_CLEAN;
} else {
if (Z_TYPE(tmp) == IS_STRING) {
- zval_dtor(&tmp);
+ zval_ptr_dtor_str(&tmp);
}
/* got the key - return it */
return (EVP_PKEY*)what;
*resourceval = zend_register_resource(key, le_key);
}
if (Z_TYPE(tmp) == IS_STRING) {
- zval_dtor(&tmp);
+ zval_ptr_dtor_str(&tmp);
}
return key;
}
}
do_fetch_class_prepare(stmt);
- zval_dtor(&val);
+ zval_ptr_dtor_str(&val);
}
ce = stmt->fetch.cls.ce;
if (!ce) {
pgsql_result = pg_result->result;
array_init(return_value);
if (php_pgsql_result2array(pgsql_result, return_value, result_type) == FAILURE) {
- zval_dtor(return_value);
+ zend_array_destroy(Z_ARR_P(return_value));
RETURN_FALSE;
}
}
}
if (PQputCopyData(pgsql, query, (int)strlen(query)) != 1) {
efree(query);
- zval_dtor(&tmp);
+ zval_ptr_dtor_str(&tmp);
PHP_PQ_ERROR("copy failed: %s", pgsql);
RETURN_FALSE;
}
efree(query);
- zval_dtor(&tmp);
+ zval_ptr_dtor_str(&tmp);
} ZEND_HASH_FOREACH_END();
if (PQputCopyEnd(pgsql, NULL) != 1) {
}
if (PQputline(pgsql, query)==EOF) {
efree(query);
- zval_dtor(&tmp);
+ zval_ptr_dtor_str(&tmp);
PHP_PQ_ERROR("copy failed: %s", pgsql);
RETURN_FALSE;
}
efree(query);
- zval_dtor(&tmp);
+ zval_ptr_dtor_str(&tmp);
} ZEND_HASH_FOREACH_END();
if (PQputline(pgsql, "\\.\n") == EOF) {
array_init(return_value);
if (php_pgsql_meta_data(pgsql, table_name, return_value, extended) == FAILURE) {
- zval_dtor(return_value); /* destroy array */
+ zend_array_destroy(Z_ARR_P(return_value)); /* destroy array */
RETURN_FALSE;
}
}
}
array_init(return_value);
if (php_pgsql_convert(pg_link, table_name, values, return_value, option) == FAILURE) {
- zval_dtor(return_value);
+ zend_array_destroy(Z_ARR_P(return_value));
RETURN_FALSE;
}
}
str_key = estrndup(Z_STRVAL(key), str_key_len);
save = str_key;
- zval_dtor(&key);
+ zval_ptr_dtor_str(&key);
} else {
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Iterator %s returned an invalid key (must return a string)", ZSTR_VAL(ce->name));
return ZEND_HASH_APPLY_STOP;
str_key = estrndup(Z_STRVAL(key), str_key_len);
save = str_key;
- zval_dtor(&key);
+ zval_ptr_dtor_str(&key);
} else {
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Iterator %s returned an invalid key (must return a string)", ZSTR_VAL(ce->name));
return ZEND_HASH_APPLY_STOP;
array_init(return_value);
if (!php_posix_group_to_array(g, return_value)) {
- zval_dtor(return_value);
+ zend_array_destroy(Z_ARR_P(return_value));
php_error_docref(NULL, E_WARNING, "unable to convert posix group to array");
RETVAL_FALSE;
}
array_init(return_value);
if (!php_posix_group_to_array(g, return_value)) {
- zval_dtor(return_value);
+ zend_array_destroy(Z_ARR_P(return_value));
php_error_docref(NULL, E_WARNING, "unable to convert posix group struct to array");
RETVAL_FALSE;
}
array_init(return_value);
if (!php_posix_passwd_to_array(pw, return_value)) {
- zval_dtor(return_value);
+ zend_array_destroy(Z_ARR_P(return_value));
php_error_docref(NULL, E_WARNING, "unable to convert posix passwd struct to array");
RETVAL_FALSE;
}
array_init(return_value);
if (!php_posix_passwd_to_array(pw, return_value)) {
- zval_dtor(return_value);
+ zend_array_destroy(Z_ARR_P(return_value));
php_error_docref(NULL, E_WARNING, "unable to convert posix passwd struct to array");
RETVAL_FALSE;
}
for (l=limits; l->name; l++) {
if (posix_addlimit(l->limit, l->name, return_value) == FAILURE) {
- zval_dtor(return_value);
+ zend_array_destroy(Z_ARR_P(return_value));
RETURN_FALSE;
}
}
/* Invoke the __toString() method */
ZVAL_STRINGL(&fname, "__tostring", sizeof("__tostring") - 1);
result= call_user_function(NULL, object, &fname, &retval, 0, NULL);
- zval_dtor(&fname);
+ zval_ptr_dtor_str(&fname);
if (result == FAILURE) {
_DO_THROW("Invocation of method __toString() failed");
zend_throw_exception_ex(reflection_exception_ptr, 0,
"Class %s does not exist", Z_STRVAL_P(classname));
if (classname == &ztmp) {
- zval_dtor(&ztmp);
+ zval_ptr_dtor_str(&ztmp);
}
return;
}
default:
if (classname == &ztmp) {
- zval_dtor(&ztmp);
+ zval_ptr_dtor_str(&ztmp);
}
_DO_THROW("The parameter class is expected to be either a string or an object");
/* returns out of this function */
}
if (classname == &ztmp) {
- zval_dtor(&ztmp);
+ zval_ptr_dtor_str(&ztmp);
}
lcname = zend_str_tolower_dup(name_str, name_len);
if (!_php_find_ps_module(ZSTR_VAL(name))) {
php_error_docref(NULL, E_WARNING, "Cannot find named PHP session module (%s)", ZSTR_VAL(name));
- zval_dtor(return_value);
+ zval_ptr_dtor_str(return_value);
RETURN_FALSE;
}
if (PS(mod_data) || PS(mod_user_implemented)) {
if (name) {
if (memchr(ZSTR_VAL(name), '\0', ZSTR_LEN(name)) != NULL) {
php_error_docref(NULL, E_WARNING, "The save_path cannot contain NULL characters");
- zval_dtor(return_value);
+ zval_ptr_dtor_str(return_value);
RETURN_FALSE;
}
ini_name = zend_string_init("session.save_path", sizeof("session.save_path") - 1, 0);
}
if (member == &tmp_zv) {
- zval_dtor(&tmp_zv);
+ zval_ptr_dtor_str(&tmp_zv);
}
if (Z_ISUNDEF_P(rv)) {
*/
static void change_node_zval(xmlNodePtr node, zval *value)
{
- zval value_copy;
xmlChar *buffer;
int buffer_len;
xmlNodeSetContentLen(node, buffer, buffer_len);
xmlFree(buffer);
}
- if (value == &value_copy) {
- zval_dtor(value);
- }
break;
default:
php_error_docref(NULL, E_WARNING, "It is not possible to assign complex types to nodes");
if (!Z_STRLEN_P(member)) {
php_error_docref(NULL, E_WARNING, "Cannot write or create unnamed %s", attribs ? "attribute" : "element");
if (member == &tmp_zv) {
- zval_dtor(&tmp_zv);
+ zval_ptr_dtor_str(&tmp_zv);
}
return FAILURE;
}
/* break is missing intentionally */
default:
if (member == &tmp_zv) {
- zval_dtor(&tmp_zv);
+ zval_ptr_dtor_str(&tmp_zv);
}
zend_error(E_WARNING, "It is not yet possible to assign complex types to %s", attribs ? "attributes" : "properties");
return FAILURE;
}
if (member == &tmp_zv) {
- zval_dtor(&tmp_zv);
+ zval_ptr_dtor_str(&tmp_zv);
}
if (pnewnode) {
*pnewnode = newnode;
}
if (member == &tmp_zv) {
- zval_dtor(&tmp_zv);
+ zval_ptr_dtor_str(&tmp_zv);
}
return exists;
}
if (member == &tmp_zv) {
- zval_dtor(&tmp_zv);
+ zval_ptr_dtor_str(&tmp_zv);
}
}
/* }}} */
switch (is_numeric_string(Z_STRVAL(lzval), Z_STRLEN(lzval), &lval, &dval, 0)) {
case IS_DOUBLE:
- zval_dtor(&lzval);
+ zval_ptr_dtor_str(&lzval);
ZVAL_DOUBLE(&lzval, dval);
goto double_case;
case IS_LONG:
- zval_dtor(&lzval);
+ zval_ptr_dtor_str(&lzval);
ZVAL_LONG(&lzval, lval);
goto long_case;
}
_CHECK_PATH(ZSTR_VAL(varname), ZSTR_LEN(varname), "java.library.path") ||
_CHECK_PATH(ZSTR_VAL(varname), ZSTR_LEN(varname), "vpopmail.directory")) {
if (php_check_open_basedir(ZSTR_VAL(new_value))) {
- zval_dtor(return_value);
+ zval_ptr_dtor_str(return_value);
RETURN_FALSE;
}
}
#undef _CHECK_PATH
if (zend_alter_ini_entry_ex(varname, new_value, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0) == FAILURE) {
- zval_dtor(return_value);
+ zval_ptr_dtor_str(return_value);
RETURN_FALSE;
}
}
key = zend_string_init("include_path", sizeof("include_path") - 1, 0);
if (zend_alter_ini_entry_ex(key, new_value, PHP_INI_USER, PHP_INI_STAGE_RUNTIME, 0) == FAILURE) {
zend_string_release_ex(key, 0);
- zval_dtor(return_value);
+ zval_ptr_dtor_str(return_value);
RETURN_FALSE;
}
zend_string_release_ex(key, 0);
array_init(return_value);
if (zend_parse_ini_file(&fh, 0, (int)scanner_mode, ini_parser_cb, return_value) == FAILURE) {
- zval_dtor(return_value);
+ zend_array_destroy(Z_ARR_P(return_value));
RETURN_FALSE;
}
}
array_init(return_value);
if (zend_parse_ini_string(string, 0, (int)scanner_mode, ini_parser_cb, return_value) == FAILURE) {
- zval_dtor(return_value);
+ zend_array_destroy(Z_ARR_P(return_value));
RETVAL_FALSE;
}
efree(string);
globfree(&globbuf);
if (basedir_limit && !zend_hash_num_elements(Z_ARRVAL_P(return_value))) {
- zval_dtor(return_value);
+ zend_array_destroy(Z_ARR_P(return_value));
RETURN_FALSE;
}
}
#if defined(HAVE_DNS_SEARCH)
handle = dns_open(NULL);
if (handle == NULL) {
- zval_dtor(return_value);
+ zend_array_destroy(Z_ARR_P(return_value));
RETURN_FALSE;
}
#elif defined(HAVE_RES_NSEARCH)
memset(&state, 0, sizeof(state));
if (res_ninit(handle)) {
- zval_dtor(return_value);
+ zend_array_destroy(Z_ARR_P(return_value));
RETURN_FALSE;
}
#else
default:
php_error_docref(NULL, E_WARNING, "DNS Query failed");
}
- zval_dtor(return_value);
+ zend_array_destroy(Z_ARR_P(return_value));
RETURN_FALSE;
}
n = dn_skipname(cp, end);
if (n < 0) {
php_error_docref(NULL, E_WARNING, "Unable to parse DNS data received");
- zval_dtor(return_value);
+ zend_array_destroy(Z_ARR_P(return_value));
php_dns_free_handle(handle);
RETURN_FALSE;
}
continue;
} else {
php_error_docref(NULL, E_WARNING, "DNS Query failed");
- zval_dtor(return_value);
+ zend_array_destroy(Z_ARR_P(return_value));
RETURN_FALSE;
}
}
if ((size_t)temp_len > (size_t)(limit - buf)) {
goto quit_loop_2;
}
- zval_dtor(return_value);
+ zend_array_destroy(Z_ARR_P(return_value));
RETVAL_FALSE;
goto out;
}
break;
#else
php_error_docref(NULL, E_WARNING, "64-bit format codes are not available for 32-bit versions of PHP");
- zval_dtor(return_value);
+ zend_array_destroy(Z_ARR_P(return_value));
RETURN_FALSE;
#endif
default:
php_error_docref(NULL, E_WARNING, "Invalid format type %c", type);
- zval_dtor(return_value);
+ zend_array_destroy(Z_ARR_P(return_value));
RETURN_FALSE;
break;
}
if (size != 0 && size != -1 && size < 0) {
php_error_docref(NULL, E_WARNING, "Type %c: integer overflow", type);
- zval_dtor(return_value);
+ zend_array_destroy(Z_ARR_P(return_value));
RETURN_FALSE;
}
if (size != 0 && size != -1 && INT_MAX - size + 1 < inputpos) {
php_error_docref(NULL, E_WARNING, "Type %c: integer overflow", type);
- zval_dtor(return_value);
+ zend_array_destroy(Z_ARR_P(return_value));
RETURN_FALSE;
}
break;
} else {
php_error_docref(NULL, E_WARNING, "Type %c: not enough input, need %d, have " ZEND_LONG_FMT, type, size, inputlen - inputpos);
- zval_dtor(return_value);
+ zend_array_destroy(Z_ARR_P(return_value));
RETURN_FALSE;
}
}
BG(serialize_lock)++;
res = call_user_function(CG(function_table), struc, &fname, retval, 0, 0);
BG(serialize_lock)--;
- zval_dtor(&fname);
+ zval_ptr_dtor_str(&fname);
if (res == FAILURE || Z_ISUNDEF_P(retval)) {
zval_ptr_dtor(retval);
add_token(return_value, token_type, zendtext, zendleng, token_line);
if (Z_TYPE(token) != IS_UNDEF) {
- zval_dtor(&token);
+ zval_ptr_dtor_nogc(&token);
ZVAL_UNDEF(&token);
}
token_line = CG(zend_lineno);
}
- zval_dtor(&source_zval);
+ zval_ptr_dtor_str(&source_zval);
zend_restore_lexical_state(&original_lex_state);
return 1;
zend_restore_lexical_state(&original_lex_state);
CG(in_compilation) = original_in_compilation;
- zval_dtor(&source_zval);
+ zval_ptr_dtor_str(&source_zval);
return success;
}
ZVAL_UNDEF(&retval);
if ((ret = php_wddx_deserialize_ex(val, vallen, &retval)) == SUCCESS) {
if (Z_TYPE(retval) != IS_ARRAY) {
- zval_dtor(&retval);
+ zval_ptr_dtor_nogc(&retval);
return FAILURE;
}
ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL(retval), idx, key, ent) {
memcpy(ZSTR_VAL(str), Z_STRVAL(ent->data), Z_STRLEN(ent->data));
memcpy(ZSTR_VAL(str) + Z_STRLEN(ent->data), s, len);
ZSTR_VAL(str)[ZSTR_LEN(str)] = '\0';
- zval_dtor(&ent->data);
+ zval_ptr_dtor_str(&ent->data);
} else {
str = zend_string_init((char *)s, len, 0);
}
}
if (member == &tmp_member) {
- zval_dtor(member);
+ zval_ptr_dtor_str(&tmp_member);
}
return retval;
}
if (member == &tmp_member) {
- zval_dtor(member);
+ zval_ptr_dtor_str(&tmp_member);
}
return retval;
}
}
if (member == &tmp_member) {
- zval_dtor(member);
+ zval_ptr_dtor_str(&tmp_member);
}
}
/* }}} */
}
if (member == &tmp_member) {
- zval_dtor(member);
+ zval_ptr_dtor_str(&tmp_member);
}
return retval;
}
if (member == &tmp_member) {
- zval_dtor(member);
+ zval_ptr_dtor_str(&tmp_member);
}
return retval;
}
if (member == &tmp_member) {
- zval_dtor(member);
+ zval_ptr_dtor_str(&tmp_member);
}
return retval;
if ((add_path_len + file_stripped_len) > MAXPATHLEN) {
php_error_docref(NULL, E_WARNING, "Entry name too long (max: %d, %zd given)",
MAXPATHLEN - 1, (add_path_len + file_stripped_len));
- zval_ptr_dtor(return_value);
+ zend_array_destroy(Z_ARR_P(return_value));
RETURN_FALSE;
}
snprintf(entry_name_buf, MAXPATHLEN, "%s%s", add_path, file_stripped);
if (php_zip_add_file(intern, Z_STRVAL_P(zval_file), Z_STRLEN_P(zval_file),
entry_name, entry_name_len, 0, 0) < 0) {
- zval_dtor(return_value);
+ zend_array_destroy(Z_ARR_P(return_value));
RETURN_FALSE;
}
}
if (!symtable1) {
/* Nothing to do */
- zval_dtor(val);
+ zval_ptr_dtor_nogc(val);
return;
}
var_len = p - var;
if (var_len==0) { /* empty variable name, or variable name with a space in it */
- zval_dtor(val);
+ zval_ptr_dtor_nogc(val);
free_alloca(var_orig, use_heap);
return;
}
&& ex->symbol_table == symtable1) {
if (memcmp(var, "this", sizeof("this")-1) == 0) {
zend_throw_error(NULL, "Cannot re-assign $this");
- zval_dtor(val);
+ zval_ptr_dtor_nogc(val);
free_alloca(var_orig, use_heap);
return;
}
if (symtable1 == &EG(symbol_table) &&
var_len == sizeof("GLOBALS")-1 &&
!memcmp(var, "GLOBALS", sizeof("GLOBALS")-1)) {
- zval_dtor(val);
+ zval_ptr_dtor_nogc(val);
free_alloca(var_orig, use_heap);
return;
}
zend_symtable_str_del(ht, var, var_len);
}
- zval_dtor(val);
+ zval_ptr_dtor_nogc(val);
/* do not output the error message to the screen,
this helps us to to avoid "information disclosure" */
if (!index) {
array_init(&gpc_element);
if ((gpc_element_p = zend_hash_next_index_insert(symtable1, &gpc_element)) == NULL) {
- zval_ptr_dtor(&gpc_element);
- zval_dtor(val);
+ zend_array_destroy(Z_ARR(gpc_element));
+ zval_ptr_dtor_nogc(val);
free_alloca(var_orig, use_heap);
return;
}
gpc_element_p = Z_INDIRECT_P(gpc_element_p);
}
if (Z_TYPE_P(gpc_element_p) != IS_ARRAY) {
- zval_ptr_dtor(gpc_element_p);
+ zval_ptr_dtor_nogc(gpc_element_p);
array_init(gpc_element_p);
}
}
plain_var:
if (!index) {
if (zend_hash_next_index_insert(symtable1, val) == NULL) {
- zval_ptr_dtor(val);
+ zval_ptr_dtor_nogc(val);
}
} else {
zend_ulong idx;
if (Z_TYPE(PG(http_globals)[TRACK_VARS_COOKIE]) != IS_UNDEF &&
symtable1 == Z_ARRVAL(PG(http_globals)[TRACK_VARS_COOKIE]) &&
zend_symtable_str_exists(symtable1, index, index_len)) {
- zval_ptr_dtor(val);
+ zval_ptr_dtor_nogc(val);
} else if (ZEND_HANDLE_NUMERIC_STR(index, index_len, idx)) {
zend_hash_index_update(symtable1, idx, val);
} else {
array_init(&array);
switch (arg) {
case PARSE_POST:
- zval_ptr_dtor(&PG(http_globals)[TRACK_VARS_POST]);
+ zval_ptr_dtor_nogc(&PG(http_globals)[TRACK_VARS_POST]);
ZVAL_COPY_VALUE(&PG(http_globals)[TRACK_VARS_POST], &array);
break;
case PARSE_GET:
- zval_ptr_dtor(&PG(http_globals)[TRACK_VARS_GET]);
+ zval_ptr_dtor_nogc(&PG(http_globals)[TRACK_VARS_GET]);
ZVAL_COPY_VALUE(&PG(http_globals)[TRACK_VARS_GET], &array);
break;
case PARSE_COOKIE:
- zval_ptr_dtor(&PG(http_globals)[TRACK_VARS_COOKIE]);
+ zval_ptr_dtor_nogc(&PG(http_globals)[TRACK_VARS_COOKIE]);
ZVAL_COPY_VALUE(&PG(http_globals)[TRACK_VARS_COOKIE], &array);
break;
}
zval *arr = &PG(http_globals)[TRACK_VARS_SERVER];
HashTable *ht;
- zval_ptr_dtor(arr);
+ zval_ptr_dtor_nogc(arr);
array_init(arr);
/* Server variables */
if (PG(variables_order) && (strchr(PG(variables_order),'G') || strchr(PG(variables_order),'g'))) {
sapi_module.treat_data(PARSE_GET, NULL, NULL);
} else {
- zval_ptr_dtor(&PG(http_globals)[TRACK_VARS_GET]);
+ zval_ptr_dtor_nogc(&PG(http_globals)[TRACK_VARS_GET]);
array_init(&PG(http_globals)[TRACK_VARS_GET]);
}
!strcasecmp(SG(request_info).request_method, "POST")) {
sapi_module.treat_data(PARSE_POST, NULL, NULL);
} else {
- zval_ptr_dtor(&PG(http_globals)[TRACK_VARS_POST]);
+ zval_ptr_dtor_nogc(&PG(http_globals)[TRACK_VARS_POST]);
array_init(&PG(http_globals)[TRACK_VARS_POST]);
}
if (PG(variables_order) && (strchr(PG(variables_order),'C') || strchr(PG(variables_order),'c'))) {
sapi_module.treat_data(PARSE_COOKIE, NULL, NULL);
} else {
- zval_ptr_dtor(&PG(http_globals)[TRACK_VARS_COOKIE]);
+ zval_ptr_dtor_nogc(&PG(http_globals)[TRACK_VARS_COOKIE]);
array_init(&PG(http_globals)[TRACK_VARS_COOKIE]);
}
}
} else {
- zval_ptr_dtor(&PG(http_globals)[TRACK_VARS_SERVER]);
+ zval_ptr_dtor_nogc(&PG(http_globals)[TRACK_VARS_SERVER]);
array_init(&PG(http_globals)[TRACK_VARS_SERVER]);
}
static zend_bool php_auto_globals_create_env(zend_string *name)
{
- zval_ptr_dtor(&PG(http_globals)[TRACK_VARS_ENV]);
+ zval_ptr_dtor_nogc(&PG(http_globals)[TRACK_VARS_ENV]);
array_init(&PG(http_globals)[TRACK_VARS_ENV]);
if (PG(variables_order) && (strchr(PG(variables_order),'E') || strchr(PG(variables_order),'e'))) {
if (adjust_width && adjust == LEFT && (size_t)min_width > s_len)
PAD((size_t)min_width, s_len, pad_char);
if (free_zcopy) {
- zval_dtor(&zcopy);
+ zval_ptr_dtor_str(&zcopy);
}
}
skip_output:
}
if (free_zcopy) {
- zval_dtor(&zcopy);
+ zval_ptr_dtor_str(&zcopy);
}
}
skip_output:
Z_ARR_P(array_ptr) != Z_ARR(PG(http_globals)[TRACK_VARS_ENV]) &&
zend_hash_num_elements(Z_ARRVAL(PG(http_globals)[TRACK_VARS_ENV])) > 0
) {
- zval_dtor(array_ptr);
+ zval_ptr_dtor_nogc(array_ptr);
ZVAL_DUP(array_ptr, &PG(http_globals)[TRACK_VARS_ENV]);
return;
} else if (Z_TYPE(PG(http_globals)[TRACK_VARS_SERVER]) == IS_ARRAY &&
Z_ARR_P(array_ptr) != Z_ARR(PG(http_globals)[TRACK_VARS_SERVER]) &&
zend_hash_num_elements(Z_ARRVAL(PG(http_globals)[TRACK_VARS_SERVER])) > 0
) {
- zval_dtor(array_ptr);
+ zval_ptr_dtor_nogc(array_ptr);
ZVAL_DUP(array_ptr, &PG(http_globals)[TRACK_VARS_SERVER]);
return;
}
new_break.ops = zend_compile_string(&pv, "Conditional Breakpoint Code");
- zval_dtor(&pv);
+ zval_ptr_dtor_str(&pv);
if (new_break.ops) {
brake = zend_hash_index_update_mem(&PHPDBG_G(bp)[PHPDBG_BREAK_COND], hash, &new_break, sizeof(phpdbg_breakcond_t));
if (adjust_width && adjust == LEFT && min_width > s_len)
PAD(min_width, s_len, pad_char);
if (free_zcopy) {
- zval_dtor(&zcopy);
+ zval_ptr_dtor_str(&zcopy);
}
}
skip_output:
zval_ptr_dtor(&fretval);
}
- zval_dtor(&fci.function_name);
+ zval_ptr_dtor_str(&fci.function_name);
efree(lc_name);
return SUCCESS;
static void phpdbg_rebuild_http_globals_array(int type, const char *name) {
zval *zvp;
if (Z_TYPE(PG(http_globals)[type]) != IS_UNDEF) {
- zval_dtor(&PG(http_globals)[type]);
+ zval_ptr_dtor_nogc(&PG(http_globals)[type]);
}
if ((zvp = zend_hash_str_find(&EG(symbol_table), name, strlen(name)))) {
Z_ADDREF_P(zvp);
*len = ZSTR_LEN(buf.s);
}
- zval_dtor(&array);
+ zend_array_destroy(Z_ARR(array));
}