diff options
author | Dmitry Stogov <dmitry@zend.com> | 2018-07-04 19:22:24 +0300 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2018-07-04 19:22:24 +0300 |
commit | 4a475a4976db92e71949786cdf5990c61514261e (patch) | |
tree | 6934c9e00200e6388256656b8fa71c97a1a3a158 | |
parent | d798fd491be77943fb751ad97d85475bf324192c (diff) | |
download | php-git-4a475a4976db92e71949786cdf5990c61514261e.tar.gz |
Replace legacy zval_dtor() by zval_ptr_dtor_nogc() or even more specialized destructors.
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.
52 files changed, 174 insertions, 178 deletions
diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 20b2d65b8d..1699f1b50a 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -3465,7 +3465,7 @@ ZEND_API zend_bool zend_make_callable(zval *callable, zend_string **callable_nam 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)); diff --git a/Zend/zend_ast.c b/Zend/zend_ast.c index 838cc361ff..ff1fd1b744 100644 --- a/Zend/zend_ast.c +++ b/Zend/zend_ast.c @@ -405,12 +405,12 @@ static int zend_ast_add_array_element(zval *result, zval *offset, zval *expr) 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); @@ -448,13 +448,13 @@ ZEND_API int ZEND_FASTCALL zend_ast_evaluate(zval *result, zend_ast *ast, zend_c 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: @@ -462,15 +462,15 @@ ZEND_API int ZEND_FASTCALL zend_ast_evaluate(zval *result, zend_ast *ast, zend_c 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: @@ -479,7 +479,7 @@ ZEND_API int ZEND_FASTCALL zend_ast_evaluate(zval *result, zend_ast *ast, zend_c } 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: @@ -517,16 +517,16 @@ ZEND_API int ZEND_FASTCALL zend_ast_evaluate(zval *result, zend_ast *ast, zend_c } 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)) { @@ -537,14 +537,14 @@ ZEND_API int ZEND_FASTCALL zend_ast_evaluate(zval *result, zend_ast *ast, zend_c 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)) { @@ -556,19 +556,19 @@ ZEND_API int ZEND_FASTCALL zend_ast_evaluate(zval *result, zend_ast *ast, zend_c *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: @@ -580,11 +580,11 @@ ZEND_API int ZEND_FASTCALL zend_ast_evaluate(zval *result, zend_ast *ast, zend_c *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: @@ -593,7 +593,7 @@ ZEND_API int ZEND_FASTCALL zend_ast_evaluate(zval *result, zend_ast *ast, zend_c } 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: @@ -602,7 +602,7 @@ ZEND_API int ZEND_FASTCALL zend_ast_evaluate(zval *result, zend_ast *ast, zend_c } else { ZVAL_LONG(&op1, 0); ret = sub_function(result, &op1, &op2); - zval_dtor(&op2); + zval_ptr_dtor_nogc(&op2); } break; case ZEND_AST_ARRAY: @@ -619,21 +619,21 @@ ZEND_API int ZEND_FASTCALL zend_ast_evaluate(zval *result, zend_ast *ast, zend_c 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; } } @@ -647,13 +647,13 @@ ZEND_API int ZEND_FASTCALL zend_ast_evaluate(zval *result, zend_ast *ast, zend_c 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: diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 602d639f25..c050855ae8 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -460,7 +460,7 @@ static int lookup_cv(zend_op_array *op_array, zend_string *name) /* {{{ */{ 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 { @@ -3449,7 +3449,7 @@ int zend_compile_func_strlen(znode *result, zend_ast_list *args) /* {{{ */ 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); } @@ -4608,7 +4608,7 @@ void zend_resolve_goto_label(zend_op_array *op_array, zend_op *opline) /* {{{ */ 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; @@ -5101,7 +5101,7 @@ void zend_compile_switch(zend_ast *ast) /* {{{ */ 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); @@ -5377,7 +5377,7 @@ void zend_compile_declare(zend_ast *ast) /* {{{ */ 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)) { diff --git a/Zend/zend_constants.c b/Zend/zend_constants.c index daf430d1f9..fe1d9e235b 100644 --- a/Zend/zend_constants.c +++ b/Zend/zend_constants.c @@ -40,7 +40,7 @@ void free_zend_constant(zval *zv) 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); } @@ -514,7 +514,7 @@ ZEND_API int zend_register_constant(zend_constant *c) 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; } diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index eba3b625ab..d08b77a520 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -943,7 +943,7 @@ ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, const zval *k 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); @@ -1055,7 +1055,7 @@ ZEND_API int zend_eval_stringl(char *str, size_t str_len, zval *retval_ptr, char } else { retval = FAILURE; } - zval_dtor(&pv); + zval_ptr_dtor_str(&pv); return retval; } /* }}} */ diff --git a/Zend/zend_language_scanner.c b/Zend/zend_language_scanner.c index db713464de..8621f952ae 100644 --- a/Zend/zend_language_scanner.c +++ b/Zend/zend_language_scanner.c @@ -1195,7 +1195,7 @@ static zend_bool strip_multiline_string_indentation( return 1; error: - zval_dtor(zendlval); + zval_ptr_dtor_str(zendlval); ZVAL_UNDEF(zendlval); return 0; @@ -4743,7 +4743,7 @@ yy397: ZVAL_UNDEF(&zv); retval = lex_scan(&zv, NULL); - zval_dtor(&zv); + zval_ptr_dtor_nogc(&zv); if (EG(exception)) { zend_clear_exception(); diff --git a/Zend/zend_language_scanner.l b/Zend/zend_language_scanner.l index 5005634dce..c75bf3c40c 100644 --- a/Zend/zend_language_scanner.l +++ b/Zend/zend_language_scanner.l @@ -1192,7 +1192,7 @@ static zend_bool strip_multiline_string_indentation( return 1; error: - zval_dtor(zendlval); + zval_ptr_dtor_str(zendlval); ZVAL_UNDEF(zendlval); return 0; @@ -2355,7 +2355,7 @@ skip_escape_conversion: ZVAL_UNDEF(&zv); retval = lex_scan(&zv, NULL); - zval_dtor(&zv); + zval_ptr_dtor_nogc(&zv); if (EG(exception)) { zend_clear_exception(); diff --git a/ext/date/php_date.c b/ext/date/php_date.c index 174216ea50..6f7f138f8e 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -2064,7 +2064,7 @@ static int date_interval_has_property(zval *object, zval *member, int type, void 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; } @@ -2084,7 +2084,7 @@ static int date_interval_has_property(zval *object, zval *member, int type, void } if (member == &tmp_member) { - zval_dtor(member); + zval_ptr_dtor_str(&tmp_member); } return retval; @@ -4159,7 +4159,7 @@ zval *date_interval_read_property(zval *object, zval *member, int type, void **c 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; } @@ -4186,7 +4186,7 @@ zval *date_interval_read_property(zval *object, zval *member, int type, void **c 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; @@ -4203,7 +4203,7 @@ zval *date_interval_read_property(zval *object, zval *member, int type, void **c } if (member == &tmp_member) { - zval_dtor(member); + zval_ptr_dtor_str(&tmp_member); } return retval; @@ -4227,7 +4227,7 @@ void date_interval_write_property(zval *object, zval *member, zval *value, void 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; } @@ -4255,7 +4255,7 @@ void date_interval_write_property(zval *object, zval *member, zval *value, void } while(0); if (member == &tmp_member) { - zval_dtor(member); + zval_ptr_dtor_str(&tmp_member); } } /* }}} */ @@ -4287,7 +4287,7 @@ static zval *date_interval_get_property_ptr_ptr(zval *object, zval *member, int } if (member == &tmp_member) { - zval_dtor(member); + zval_ptr_dtor_str(&tmp_member); } return ret; diff --git a/ext/dom/xpath.c b/ext/dom/xpath.c index a63abaf6cd..d6c410b17d 100644 --- a/ext/dom/xpath.c +++ b/ext/dom/xpath.c @@ -227,7 +227,7 @@ static void dom_xpath_ext_function_php(xmlXPathParserContextPtr ctxt, int nargs, } } 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]); diff --git a/ext/gmp/gmp.c b/ext/gmp/gmp.c index b3cc77e750..93c69d3347 100644 --- a/ext/gmp/gmp.c +++ b/ext/gmp/gmp.c @@ -577,7 +577,7 @@ static int gmp_serialize(zval *object, unsigned char **buffer, size_t *buf_len, 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); diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c index 7070454433..bdd4a26da5 100644 --- a/ext/iconv/iconv.c +++ b/ext/iconv/iconv.c @@ -2435,7 +2435,7 @@ PHP_FUNCTION(iconv_mime_decode_headers) 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; } } diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c index d5f07a3e22..86b0011f09 100644 --- a/ext/imap/php_imap.c +++ b/ext/imap/php_imap.c @@ -1436,7 +1436,7 @@ PHP_FUNCTION(imap_get_quota) 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; } } @@ -1465,7 +1465,7 @@ PHP_FUNCTION(imap_get_quotaroot) 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; } } @@ -1542,7 +1542,7 @@ PHP_FUNCTION(imap_getacl) 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; } @@ -4290,7 +4290,7 @@ PHP_FUNCTION(imap_mime_header_decode) } if (decode == NULL) { efree(charset); - zval_dtor(return_value); + zend_array_destroy(Z_ARR_P(return_value)); RETURN_FALSE; } object_init(&myobject); diff --git a/ext/interbase/php_ibase_udf.c b/ext/interbase/php_ibase_udf.c index f7dfe2db15..b8bb6034bb 100644 --- a/ext/interbase/php_ibase_udf.c +++ b/ext/interbase/php_ibase_udf.c @@ -302,7 +302,7 @@ static void call_php(char *name, PARAMDSC *r, int argc, PARAMDSC **argv) } } - 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)) { diff --git a/ext/intl/collator/collator_convert.c b/ext/intl/collator/collator_convert.c index 63132b1eb0..6ec24afe10 100644 --- a/ext/intl/collator/collator_convert.c +++ b/ext/intl/collator/collator_convert.c @@ -275,7 +275,7 @@ zval* collator_convert_object_to_string( zval* obj, zval *rv ) 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)); @@ -392,7 +392,7 @@ zval* collator_make_printable_zval( zval* arg, zval *rv) if( use_copy ) { str = collator_convert_zstr_utf8_to_utf16( &arg_copy, rv ); - zval_dtor( &arg_copy ); + zval_ptr_dtor_str( &arg_copy ); } else { diff --git a/ext/intl/converter/converter.c b/ext/intl/converter/converter.c index 7d012b86bb..079f69e993 100644 --- a/ext/intl/converter/converter.c +++ b/ext/intl/converter/converter.c @@ -931,7 +931,7 @@ static PHP_METHOD(UConverter, getAliases) { 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); @@ -959,7 +959,7 @@ static PHP_METHOD(UConverter, getStandards) { 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); diff --git a/ext/intl/locale/locale_methods.c b/ext/intl/locale/locale_methods.c index 437b9e404d..35bec40a7a 100644 --- a/ext/intl/locale/locale_methods.c +++ b/ext/intl/locale/locale_methods.c @@ -744,7 +744,7 @@ PHP_FUNCTION( locale_get_keywords ) if( kw_value_str){ zend_string_efree( kw_value_str ); } - zval_dtor(return_value); + zend_array_destroy(Z_ARR_P(return_value)); RETURN_FALSE; } diff --git a/ext/intl/timezone/timezone_class.cpp b/ext/intl/timezone/timezone_class.cpp index 929797a96e..1f20ea9b52 100644 --- a/ext/intl/timezone/timezone_class.cpp +++ b/ext/intl/timezone/timezone_class.cpp @@ -154,7 +154,7 @@ U_CFUNC TimeZone *timezone_process_timezone_argument(zval *zv_timezone, 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(); @@ -164,7 +164,7 @@ U_CFUNC TimeZone *timezone_process_timezone_argument(zval *zv_timezone, 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 && @@ -172,7 +172,7 @@ U_CFUNC TimeZone *timezone_process_timezone_argument(zval *zv_timezone, 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 { @@ -188,7 +188,7 @@ U_CFUNC TimeZone *timezone_process_timezone_argument(zval *zv_timezone, 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); @@ -198,7 +198,7 @@ U_CFUNC TimeZone *timezone_process_timezone_argument(zval *zv_timezone, 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) { @@ -208,13 +208,13 @@ U_CFUNC TimeZone *timezone_process_timezone_argument(zval *zv_timezone, 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; } diff --git a/ext/intl/transliterator/transliterator_class.c b/ext/intl/transliterator/transliterator_class.c index 24de8f6544..3c58b43324 100644 --- a/ext/intl/transliterator/transliterator_class.c +++ b/ext/intl/transliterator/transliterator_class.c @@ -202,7 +202,7 @@ err: #define TRANSLITERATOR_PROPERTY_HANDLER_EPILOG \ if( member == &tmp_member ) \ { \ - zval_dtor( &tmp_member ); \ + zval_ptr_dtor_str( &tmp_member ); \ } /* {{{ get_property_ptr_ptr handler */ diff --git a/ext/intl/transliterator/transliterator_methods.c b/ext/intl/transliterator/transliterator_methods.c index f0e5dcd2e8..6267b383ae 100644 --- a/ext/intl/transliterator/transliterator_methods.c +++ b/ext/intl/transliterator/transliterator_methods.c @@ -281,7 +281,7 @@ PHP_FUNCTION( transliterator_list_ids ) 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 ); diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c index 30923b3350..f81f2b65e4 100644 --- a/ext/ldap/ldap.c +++ b/ext/ldap/ldap.c @@ -1814,7 +1814,7 @@ PHP_FUNCTION(ldap_get_entries) 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; } diff --git a/ext/mbstring/php_mbregex.c b/ext/mbstring/php_mbregex.c index 4d3e44f1ec..608cdc9d8f 100644 --- a/ext/mbstring/php_mbregex.c +++ b/ext/mbstring/php_mbregex.c @@ -986,7 +986,7 @@ static void _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, OnigOp 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; @@ -1146,7 +1146,7 @@ PHP_FUNCTION(mb_split) 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; } diff --git a/ext/mysqli/mysqli.c b/ext/mysqli/mysqli.c index c885be61c0..06a170b306 100644 --- a/ext/mysqli/mysqli.c +++ b/ext/mysqli/mysqli.c @@ -325,7 +325,7 @@ zval *mysqli_read_property(zval *object, zval *member, int type, void **cache_sl } if (member == &tmp_member) { - zval_dtor(member); + zval_ptr_dtor_str(&tmp_member); } return retval; @@ -357,7 +357,7 @@ void mysqli_write_property(zval *object, zval *member, zval *value, void **cache } if (member == &tmp_member) { - zval_dtor(member); + zval_ptr_dtor_str(&tmp_member); } } /* }}} */ diff --git a/ext/mysqlnd/mysqlnd_result.c b/ext/mysqlnd/mysqlnd_result.c index b436f23ac0..e3eac9dfe1 100644 --- a/ext/mysqlnd/mysqlnd_result.c +++ b/ext/mysqlnd/mysqlnd_result.c @@ -1715,10 +1715,10 @@ MYSQLND_METHOD(mysqlnd_res, fetch_into)(MYSQLND_RES * result, const unsigned int 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(); diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index 4aae81dbd7..ca7e512efd 100644 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -3730,7 +3730,7 @@ static EVP_PKEY * php_openssl_evp_from_zval( #define TMP_CLEAN \ if (Z_TYPE(tmp) == IS_STRING) {\ - zval_dtor(&tmp); \ + zval_ptr_dtor_str(&tmp); \ } \ return NULL; @@ -3796,7 +3796,7 @@ static EVP_PKEY * php_openssl_evp_from_zval( 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; @@ -3885,7 +3885,7 @@ static EVP_PKEY * php_openssl_evp_from_zval( *resourceval = zend_register_resource(key, le_key); } if (Z_TYPE(tmp) == IS_STRING) { - zval_dtor(&tmp); + zval_ptr_dtor_str(&tmp); } return key; } diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c index fbd2b12de4..b4f08a87a3 100644 --- a/ext/pdo/pdo_stmt.c +++ b/ext/pdo/pdo_stmt.c @@ -915,7 +915,7 @@ static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value, enum pdo_ } do_fetch_class_prepare(stmt); - zval_dtor(&val); + zval_ptr_dtor_str(&val); } ce = stmt->fetch.cls.ce; if (!ce) { diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c index a979ab5182..a75abf965c 100644 --- a/ext/pgsql/pgsql.c +++ b/ext/pgsql/pgsql.c @@ -2911,7 +2911,7 @@ PHP_FUNCTION(pg_fetch_all) 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; } } @@ -4278,12 +4278,12 @@ PHP_FUNCTION(pg_copy_from) } 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) { @@ -4302,12 +4302,12 @@ PHP_FUNCTION(pg_copy_from) } 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) { @@ -5636,7 +5636,7 @@ PHP_FUNCTION(pg_meta_data) 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; } } @@ -6520,7 +6520,7 @@ PHP_FUNCTION(pg_convert) } 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; } } diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c index 5f866c6b2a..f2fd426241 100644 --- a/ext/phar/phar_object.c +++ b/ext/phar/phar_object.c @@ -1448,7 +1448,7 @@ static int phar_build(zend_object_iterator *iter, void *puser) /* {{{ */ 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; @@ -1576,7 +1576,7 @@ phar_spl_fileinfo: 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; diff --git a/ext/posix/posix.c b/ext/posix/posix.c index e7fdc1bf3b..0d8edde4e2 100644 --- a/ext/posix/posix.c +++ b/ext/posix/posix.c @@ -1097,7 +1097,7 @@ PHP_FUNCTION(posix_getgrnam) 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; } @@ -1150,7 +1150,7 @@ PHP_FUNCTION(posix_getgrgid) 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; } @@ -1217,7 +1217,7 @@ PHP_FUNCTION(posix_getpwnam) 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; } @@ -1268,7 +1268,7 @@ PHP_FUNCTION(posix_getpwuid) 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; } @@ -1387,7 +1387,7 @@ PHP_FUNCTION(posix_getrlimit) 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; } } diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 03590d47e7..a793536d8d 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -1452,7 +1452,7 @@ ZEND_METHOD(reflection, export) /* 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"); @@ -2976,7 +2976,7 @@ ZEND_METHOD(reflection_method, __construct) 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; } @@ -2988,14 +2988,14 @@ ZEND_METHOD(reflection_method, __construct) 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); diff --git a/ext/session/session.c b/ext/session/session.c index b8a895c504..609542d51c 100644 --- a/ext/session/session.c +++ b/ext/session/session.c @@ -1814,7 +1814,7 @@ static PHP_FUNCTION(session_module_name) 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)) { @@ -2019,7 +2019,7 @@ static PHP_FUNCTION(session_save_path) 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); diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c index 01eadf98d0..4ff82631e7 100644 --- a/ext/simplexml/simplexml.c +++ b/ext/simplexml/simplexml.c @@ -352,7 +352,7 @@ long_dim: } if (member == &tmp_zv) { - zval_dtor(&tmp_zv); + zval_ptr_dtor_str(&tmp_zv); } if (Z_ISUNDEF_P(rv)) { @@ -383,7 +383,6 @@ static zval *sxe_dimension_read(zval *object, zval *offset, int type, zval *rv) */ static void change_node_zval(xmlNodePtr node, zval *value) { - zval value_copy; xmlChar *buffer; int buffer_len; @@ -408,9 +407,6 @@ static void change_node_zval(xmlNodePtr node, zval *value) 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"); @@ -470,7 +466,7 @@ long_dim: 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; } @@ -531,7 +527,7 @@ long_dim: /* 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; @@ -643,7 +639,7 @@ next_iter: } if (member == &tmp_zv) { - zval_dtor(&tmp_zv); + zval_ptr_dtor_str(&tmp_zv); } if (pnewnode) { *pnewnode = newnode; @@ -801,7 +797,7 @@ static int sxe_prop_dim_exists(zval *object, zval *member, int check_empty, zend } if (member == &tmp_zv) { - zval_dtor(&tmp_zv); + zval_ptr_dtor_str(&tmp_zv); } return exists; @@ -926,7 +922,7 @@ next_iter: } if (member == &tmp_zv) { - zval_dtor(&tmp_zv); + zval_ptr_dtor_str(&tmp_zv); } } /* }}} */ diff --git a/ext/sockets/conversions.c b/ext/sockets/conversions.c index 291aeb2981..feb97356c9 100644 --- a/ext/sockets/conversions.c +++ b/ext/sockets/conversions.c @@ -336,12 +336,12 @@ double_case: 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; } diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 578c52d3e9..6af26434b8 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -5530,7 +5530,7 @@ PHP_FUNCTION(ini_set) _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; } } @@ -5538,7 +5538,7 @@ PHP_FUNCTION(ini_set) #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; } } @@ -5581,7 +5581,7 @@ PHP_FUNCTION(set_include_path) 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); @@ -6076,7 +6076,7 @@ PHP_FUNCTION(parse_ini_file) 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; } } @@ -6118,7 +6118,7 @@ PHP_FUNCTION(parse_ini_string) 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); diff --git a/ext/standard/dir.c b/ext/standard/dir.c index f93fb0dbb5..b170d1a7b4 100644 --- a/ext/standard/dir.c +++ b/ext/standard/dir.c @@ -545,7 +545,7 @@ no_results: 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; } } diff --git a/ext/standard/dns.c b/ext/standard/dns.c index 614bc32119..a3bbb6d91c 100644 --- a/ext/standard/dns.c +++ b/ext/standard/dns.c @@ -921,13 +921,13 @@ PHP_FUNCTION(dns_get_record) #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 @@ -954,7 +954,7 @@ PHP_FUNCTION(dns_get_record) default: php_error_docref(NULL, E_WARNING, "DNS Query failed"); } - zval_dtor(return_value); + zend_array_destroy(Z_ARR_P(return_value)); RETURN_FALSE; } @@ -971,7 +971,7 @@ PHP_FUNCTION(dns_get_record) 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; } diff --git a/ext/standard/dns_win32.c b/ext/standard/dns_win32.c index 4bca7128a1..41f8d1e159 100644 --- a/ext/standard/dns_win32.c +++ b/ext/standard/dns_win32.c @@ -457,7 +457,7 @@ PHP_FUNCTION(dns_get_record) 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; } } diff --git a/ext/standard/file.c b/ext/standard/file.c index 643876acb9..5ed42dd2e5 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -2190,7 +2190,7 @@ PHPAPI void php_fgetcsv(php_stream *stream, char delimiter, char enclosure, char 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; } diff --git a/ext/standard/pack.c b/ext/standard/pack.c index 846f404af6..e467cf8954 100644 --- a/ext/standard/pack.c +++ b/ext/standard/pack.c @@ -850,7 +850,7 @@ PHP_FUNCTION(unpack) 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 @@ -870,14 +870,14 @@ PHP_FUNCTION(unpack) 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; } @@ -896,7 +896,7 @@ PHP_FUNCTION(unpack) 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; } @@ -1192,7 +1192,7 @@ PHP_FUNCTION(unpack) 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; } } diff --git a/ext/standard/var.c b/ext/standard/var.c index 14335ba1b4..46d1b2df65 100644 --- a/ext/standard/var.c +++ b/ext/standard/var.c @@ -680,7 +680,7 @@ static int php_var_serialize_call_sleep(zval *retval, zval *struc) /* {{{ */ 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); diff --git a/ext/tokenizer/tokenizer.c b/ext/tokenizer/tokenizer.c index 60df344395..dae79c0173 100644 --- a/ext/tokenizer/tokenizer.c +++ b/ext/tokenizer/tokenizer.c @@ -148,7 +148,7 @@ static zend_bool tokenize(zval *return_value, zend_string *source) 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); } @@ -177,7 +177,7 @@ static zend_bool tokenize(zval *return_value, zend_string *source) token_line = CG(zend_lineno); } - zval_dtor(&source_zval); + zval_ptr_dtor_str(&source_zval); zend_restore_lexical_state(&original_lex_state); return 1; @@ -255,7 +255,7 @@ static zend_bool tokenize_parse(zval *return_value, zend_string *source) 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; } diff --git a/ext/wddx/wddx.c b/ext/wddx/wddx.c index 6dde04f4e5..a7596a5f27 100644 --- a/ext/wddx/wddx.c +++ b/ext/wddx/wddx.c @@ -305,7 +305,7 @@ PS_SERIALIZER_DECODE_FUNC(wddx) 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) { @@ -1065,7 +1065,7 @@ static void php_wddx_process_data(void *user_data, const XML_Char *s, int len) 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); } diff --git a/ext/xmlreader/php_xmlreader.c b/ext/xmlreader/php_xmlreader.c index 0b84a702b8..38343e514b 100644 --- a/ext/xmlreader/php_xmlreader.c +++ b/ext/xmlreader/php_xmlreader.c @@ -139,7 +139,7 @@ zval *xmlreader_get_property_ptr_ptr(zval *object, zval *member, int type, void } if (member == &tmp_member) { - zval_dtor(member); + zval_ptr_dtor_str(&tmp_member); } return retval; @@ -176,7 +176,7 @@ zval *xmlreader_read_property(zval *object, zval *member, int type, void **cache } if (member == &tmp_member) { - zval_dtor(member); + zval_ptr_dtor_str(&tmp_member); } return retval; } @@ -206,7 +206,7 @@ void xmlreader_write_property(zval *object, zval *member, zval *value, void **ca } if (member == &tmp_member) { - zval_dtor(member); + zval_ptr_dtor_str(&tmp_member); } } /* }}} */ diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c index d355ca3425..24dd0020d6 100644 --- a/ext/zip/php_zip.c +++ b/ext/zip/php_zip.c @@ -896,7 +896,7 @@ static zval *php_zip_get_property_ptr_ptr(zval *object, zval *member, int type, } if (member == &tmp_member) { - zval_dtor(member); + zval_ptr_dtor_str(&tmp_member); } return retval; @@ -932,7 +932,7 @@ static zval *php_zip_read_property(zval *object, zval *member, int type, void ** } if (member == &tmp_member) { - zval_dtor(member); + zval_ptr_dtor_str(&tmp_member); } return retval; @@ -977,7 +977,7 @@ static int php_zip_has_property(zval *object, zval *member, int type, void **cac } if (member == &tmp_member) { - zval_dtor(member); + zval_ptr_dtor_str(&tmp_member); } return retval; @@ -1743,7 +1743,7 @@ static void php_zip_add_from_pattern(INTERNAL_FUNCTION_PARAMETERS, int type) /* 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); @@ -1760,7 +1760,7 @@ static void php_zip_add_from_pattern(INTERNAL_FUNCTION_PARAMETERS, int type) /* 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; } } diff --git a/main/php_variables.c b/main/php_variables.c index d7bc81348d..122e30bf9c 100644 --- a/main/php_variables.c +++ b/main/php_variables.c @@ -87,7 +87,7 @@ PHPAPI void php_register_variable_ex(char *var_name, zval *val, zval *track_vars if (!symtable1) { /* Nothing to do */ - zval_dtor(val); + zval_ptr_dtor_nogc(val); return; } @@ -118,7 +118,7 @@ PHPAPI void php_register_variable_ex(char *var_name, zval *val, zval *track_vars 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; } @@ -132,7 +132,7 @@ PHPAPI void php_register_variable_ex(char *var_name, zval *val, zval *track_vars && 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; } @@ -147,7 +147,7 @@ PHPAPI void php_register_variable_ex(char *var_name, zval *val, zval *track_vars 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; } @@ -170,7 +170,7 @@ PHPAPI void php_register_variable_ex(char *var_name, zval *val, zval *track_vars 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" */ @@ -208,8 +208,8 @@ PHPAPI void php_register_variable_ex(char *var_name, zval *val, zval *track_vars 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; } @@ -224,7 +224,7 @@ PHPAPI void php_register_variable_ex(char *var_name, zval *val, zval *track_vars 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); } } @@ -246,7 +246,7 @@ PHPAPI void php_register_variable_ex(char *var_name, zval *val, zval *track_vars 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; @@ -260,7 +260,7 @@ plain_var: 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 { @@ -418,15 +418,15 @@ SAPI_API SAPI_TREAT_DATA_FUNC(php_default_treat_data) 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; } @@ -654,7 +654,7 @@ static inline void php_register_server_variables(void) zval *arr = &PG(http_globals)[TRACK_VARS_SERVER]; HashTable *ht; - zval_ptr_dtor(arr); + zval_ptr_dtor_nogc(arr); array_init(arr); /* Server variables */ @@ -736,7 +736,7 @@ static zend_bool php_auto_globals_create_get(zend_string *name) 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]); } @@ -755,7 +755,7 @@ static zend_bool php_auto_globals_create_post(zend_string *name) !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]); } @@ -770,7 +770,7 @@ static zend_bool php_auto_globals_create_cookie(zend_string *name) 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]); } @@ -829,7 +829,7 @@ static zend_bool php_auto_globals_create_server(zend_string *name) } } 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]); } @@ -847,7 +847,7 @@ static zend_bool php_auto_globals_create_server(zend_string *name) 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'))) { diff --git a/main/snprintf.c b/main/snprintf.c index 2a76f23763..ac1f5cba7a 100644 --- a/main/snprintf.c +++ b/main/snprintf.c @@ -1214,7 +1214,7 @@ fmt_error: 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: diff --git a/main/spprintf.c b/main/spprintf.c index 10bce9d247..bcd2111937 100644 --- a/main/spprintf.c +++ b/main/spprintf.c @@ -817,7 +817,7 @@ fmt_error: } if (free_zcopy) { - zval_dtor(&zcopy); + zval_ptr_dtor_str(&zcopy); } } skip_output: diff --git a/sapi/litespeed/lsapi_main.c b/sapi/litespeed/lsapi_main.c index 8f2ab71cca..79478af0c6 100644 --- a/sapi/litespeed/lsapi_main.c +++ b/sapi/litespeed/lsapi_main.c @@ -247,14 +247,14 @@ static void litespeed_php_import_environment_variables(zval *array_ptr) 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; } diff --git a/sapi/phpdbg/phpdbg_bp.c b/sapi/phpdbg/phpdbg_bp.c index c104b0dc52..a10d652e33 100644 --- a/sapi/phpdbg/phpdbg_bp.c +++ b/sapi/phpdbg/phpdbg_bp.c @@ -840,7 +840,7 @@ static inline void phpdbg_create_conditional_break(phpdbg_breakcond_t *brake, co 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)); diff --git a/sapi/phpdbg/phpdbg_out.c b/sapi/phpdbg/phpdbg_out.c index 1f35a3d1d5..545e1c951d 100644 --- a/sapi/phpdbg/phpdbg_out.c +++ b/sapi/phpdbg/phpdbg_out.c @@ -799,7 +799,7 @@ fmt_error: 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: diff --git a/sapi/phpdbg/phpdbg_prompt.c b/sapi/phpdbg/phpdbg_prompt.c index 067ae73913..f406810ab9 100644 --- a/sapi/phpdbg/phpdbg_prompt.c +++ b/sapi/phpdbg/phpdbg_prompt.c @@ -196,7 +196,7 @@ static inline int phpdbg_call_register(phpdbg_param_t *stack) /* {{{ */ zval_ptr_dtor(&fretval); } - zval_dtor(&fci.function_name); + zval_ptr_dtor_str(&fci.function_name); efree(lc_name); return SUCCESS; diff --git a/sapi/phpdbg/phpdbg_wait.c b/sapi/phpdbg/phpdbg_wait.c index 305a7daf2a..8cfc337916 100644 --- a/sapi/phpdbg/phpdbg_wait.c +++ b/sapi/phpdbg/phpdbg_wait.c @@ -26,7 +26,7 @@ ZEND_EXTERN_MODULE_GLOBALS(phpdbg) 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); diff --git a/sapi/phpdbg/phpdbg_webdata_transfer.c b/sapi/phpdbg/phpdbg_webdata_transfer.c index 16c82a6118..a543f98ba7 100644 --- a/sapi/phpdbg/phpdbg_webdata_transfer.c +++ b/sapi/phpdbg/phpdbg_webdata_transfer.c @@ -171,5 +171,5 @@ PHPDBG_API void phpdbg_webdata_compress(char **msg, size_t *len) { *len = ZSTR_LEN(buf.s); } - zval_dtor(&array); + zend_array_destroy(Z_ARR(array)); } |