@@ -1544,37 +1544,23 @@ static inline zend_result build_mime_structure_from_hash(php_curl *ch, zval *zpo
1544
1544
/* {{{ Copy a cURL handle along with all of it's preferences */
1545
1545
PHP_FUNCTION (curl_copy_handle )
1546
1546
{
1547
- php_curl * ch ;
1548
- CURL * cp ;
1549
1547
zval * zid ;
1550
- php_curl * dupch ;
1551
- zval * postfields ;
1552
1548
1553
1549
ZEND_PARSE_PARAMETERS_START (1 ,1 )
1554
1550
Z_PARAM_OBJECT_OF_CLASS (zid , curl_ce )
1555
1551
ZEND_PARSE_PARAMETERS_END ();
1556
1552
1557
- ch = Z_CURL_P (zid );
1558
-
1559
- cp = curl_easy_duphandle (ch -> cp );
1560
- if (!cp ) {
1553
+ zend_object * new_object = Z_OBJ_P (zid )-> handlers -> clone_obj (Z_OBJ_P (zid ));
1554
+ if (EG (exception )) {
1555
+ if (new_object != NULL ) {
1556
+ OBJ_RELEASE (new_object );
1557
+ }
1558
+ zend_clear_exception ();
1561
1559
php_error_docref (NULL , E_WARNING , "Cannot duplicate cURL handle" );
1562
1560
RETURN_FALSE ;
1563
1561
}
1564
1562
1565
- dupch = init_curl_handle_into_zval (return_value );
1566
- dupch -> cp = cp ;
1567
-
1568
- _php_setup_easy_copy_handlers (dupch , ch );
1569
-
1570
- postfields = & ch -> postfields ;
1571
- if (Z_TYPE_P (postfields ) != IS_UNDEF ) {
1572
- if (build_mime_structure_from_hash (dupch , postfields ) == FAILURE ) {
1573
- zval_ptr_dtor (return_value );
1574
- php_error_docref (NULL , E_WARNING , "Cannot rebuild mime structure" );
1575
- RETURN_FALSE ;
1576
- }
1577
- }
1563
+ RETURN_OBJ (new_object );
1578
1564
}
1579
1565
/* }}} */
1580
1566
0 commit comments