@@ -1721,6 +1721,7 @@ static php_curl *alloc_curl_handle()
1721
1721
#if LIBCURL_VERSION_NUM >= 0x071500 /* Available since 7.21.0 */
1722
1722
ch -> handlers -> fnmatch = NULL ;
1723
1723
#endif
1724
+ ch -> clone = 1 ;
1724
1725
1725
1726
memset (& ch -> err , 0 , sizeof (struct _php_curl_error ));
1726
1727
@@ -2462,8 +2463,8 @@ static int _php_curl_setopt(php_curl *ch, long option, zval *zvalue TSRMLS_DC) /
2462
2463
HashTable * postfields ;
2463
2464
zend_string * string_key ;
2464
2465
ulong num_key ;
2465
- struct HttpPost * first = NULL ;
2466
- struct HttpPost * last = NULL ;
2466
+ struct HttpPost * first = NULL ;
2467
+ struct HttpPost * last = NULL ;
2467
2468
2468
2469
postfields = HASH_OF (zvalue );
2469
2470
if (!postfields ) {
@@ -2565,15 +2566,16 @@ static int _php_curl_setopt(php_curl *ch, long option, zval *zvalue TSRMLS_DC) /
2565
2566
} else {
2566
2567
error = curl_formadd (& first , & last ,
2567
2568
CURLFORM_COPYNAME , string_key -> val ,
2568
- CURLFORM_NAMELENGTH , string_key -> len ,
2569
+ CURLFORM_NAMELENGTH , ( long ) string_key -> len ,
2569
2570
CURLFORM_COPYCONTENTS , postval ,
2570
- CURLFORM_CONTENTSLENGTH , Z_STRLEN_P (current ),
2571
+ CURLFORM_CONTENTSLENGTH , ( long ) Z_STRLEN_P (current ),
2571
2572
CURLFORM_END );
2572
2573
}
2573
2574
2574
2575
if (numeric_key ) {
2575
2576
STR_RELEASE (string_key );
2576
2577
}
2578
+
2577
2579
} ZEND_HASH_FOREACH_END ();
2578
2580
2579
2581
SAVE_CURL_ERROR (ch , error );
@@ -2583,9 +2585,7 @@ static int _php_curl_setopt(php_curl *ch, long option, zval *zvalue TSRMLS_DC) /
2583
2585
2584
2586
if (ch -> clone == 0 ) {
2585
2587
zend_llist_clean (& ch -> to_free -> post );
2586
- } else {
2587
- -- ch -> clone ;
2588
- }
2588
+ }
2589
2589
zend_llist_add_element (& ch -> to_free -> post , & first );
2590
2590
error = curl_easy_setopt (ch -> cp , CURLOPT_HTTPPOST , first );
2591
2591
} else {
@@ -3136,7 +3136,7 @@ PHP_FUNCTION(curl_close)
3136
3136
return ;
3137
3137
}
3138
3138
3139
- zend_list_close (Z_RES_P (zid ));
3139
+ zend_list_delete (Z_RES_P (zid ));
3140
3140
}
3141
3141
/* }}} */
3142
3142
@@ -3167,14 +3167,12 @@ static void _php_curl_close_ex(php_curl *ch TSRMLS_DC)
3167
3167
curl_easy_cleanup (ch -> cp );
3168
3168
3169
3169
/* cURL destructors should be invoked only by last curl handle */
3170
- if (ch -> clone == 0 ) {
3170
+ if (-- ch -> clone == 0 ) {
3171
3171
zend_llist_clean (& ch -> to_free -> str );
3172
3172
zend_llist_clean (& ch -> to_free -> post );
3173
3173
zend_hash_destroy (ch -> to_free -> slist );
3174
3174
efree (ch -> to_free -> slist );
3175
3175
efree (ch -> to_free );
3176
- } else {
3177
- -- ch -> clone ;
3178
3176
}
3179
3177
3180
3178
smart_str_free (& ch -> handlers -> write -> buf );
0 commit comments