diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 385fe9af0bbfe..940c2f98b382f 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -5454,9 +5454,9 @@ static zend_always_inline uint32_t zend_get_arg_offset_by_name( if (EXPECTED(fbc->type == ZEND_USER_FUNCTION) || EXPECTED(fbc->common.fn_flags & ZEND_ACC_USER_ARG_INFO)) { for (uint32_t i = 0; i < num_args; i++) { - zend_arg_info *arg_info = &fbc->op_array.arg_info[i]; + zend_arg_info *arg_info = &fbc->common.arg_info[i]; if (zend_string_equals(arg_name, arg_info->name)) { - if (!fbc->op_array.refcount || !(fbc->op_array.fn_flags & ZEND_ACC_CLOSURE)) { + if (fbc->type == ZEND_USER_FUNCTION && (!fbc->op_array.refcount || !(fbc->op_array.fn_flags & ZEND_ACC_CLOSURE))) { *cache_slot = unique_id; *(uintptr_t *)(cache_slot + 1) = i; } @@ -5477,7 +5477,10 @@ static zend_always_inline uint32_t zend_get_arg_offset_by_name( } if (fbc->common.fn_flags & ZEND_ACC_VARIADIC) { - if (fbc->type == ZEND_INTERNAL_FUNCTION || !fbc->op_array.refcount || !(fbc->op_array.fn_flags & ZEND_ACC_CLOSURE)) { + if ((fbc->type == ZEND_USER_FUNCTION + && (!fbc->op_array.refcount || !(fbc->op_array.fn_flags & ZEND_ACC_CLOSURE))) + || (fbc->type == ZEND_INTERNAL_FUNCTION + && !(fbc->common.fn_flags & ZEND_ACC_USER_ARG_INFO))) { *cache_slot = unique_id; *(uintptr_t *)(cache_slot + 1) = fbc->common.num_args; } diff --git a/ext/curl/interface.c b/ext/curl/interface.c index e9e9cd5e409af..4bd6cd64fa670 100644 --- a/ext/curl/interface.c +++ b/ext/curl/interface.c @@ -1544,37 +1544,23 @@ static inline zend_result build_mime_structure_from_hash(php_curl *ch, zval *zpo /* {{{ Copy a cURL handle along with all of it's preferences */ PHP_FUNCTION(curl_copy_handle) { - php_curl *ch; - CURL *cp; zval *zid; - php_curl *dupch; - zval *postfields; ZEND_PARSE_PARAMETERS_START(1,1) Z_PARAM_OBJECT_OF_CLASS(zid, curl_ce) ZEND_PARSE_PARAMETERS_END(); - ch = Z_CURL_P(zid); - - cp = curl_easy_duphandle(ch->cp); - if (!cp) { + zend_object *new_object = Z_OBJ_P(zid)->handlers->clone_obj(Z_OBJ_P(zid)); + if (EG(exception)) { + if (new_object != NULL) { + OBJ_RELEASE(new_object); + } + zend_clear_exception(); php_error_docref(NULL, E_WARNING, "Cannot duplicate cURL handle"); RETURN_FALSE; } - dupch = init_curl_handle_into_zval(return_value); - dupch->cp = cp; - - _php_setup_easy_copy_handlers(dupch, ch); - - postfields = &ch->postfields; - if (Z_TYPE_P(postfields) != IS_UNDEF) { - if (build_mime_structure_from_hash(dupch, postfields) == FAILURE) { - zval_ptr_dtor(return_value); - php_error_docref(NULL, E_WARNING, "Cannot rebuild mime structure"); - RETURN_FALSE; - } - } + RETURN_OBJ(new_object); } /* }}} */