. Fixed bug #70145 (From field incorrectly parsed from headers). (Anatol)
. Fixed bug causing exception traces with anon classes to be truncated. (Bob)
+- Curl:
+ . Fixed bug #70330 (Segmentation Fault with multiple "curl_copy_handle").
+ (Laruence)
+
- PDO_OCI:
. Fixed bug #70308 (PDO::ATTR_PREFETCH is ignored). (Chris Jones)
#if LIBCURL_VERSION_NUM >= 0x071500 /* Available since 7.21.0 */
ch->handlers->fnmatch = NULL;
#endif
- ch->clone = 1;
+ ch->clone = emalloc(sizeof(uint32_t));
+ *ch->clone = 1;
memset(&ch->err, 0, sizeof(struct _php_curl_error));
efree(dupch->to_free->slist);
efree(dupch->to_free);
dupch->to_free = ch->to_free;
+ efree(dupch->clone);
+ dupch->clone = ch->clone;
/* Keep track of cloned copies to avoid invoking curl destructors for every clone */
- ch->clone++;
+ (*ch->clone)++;
ZVAL_RES(return_value, zend_register_resource(dupch, le_curl));
dupch->res = Z_RES_P(return_value);
return FAILURE;
}
- if (ch->clone == 0) {
+ if ((*ch->clone) == 1) {
zend_llist_clean(&ch->to_free->post);
}
zend_llist_add_element(&ch->to_free->post, &first);
curl_easy_cleanup(ch->cp);
/* cURL destructors should be invoked only by last curl handle */
- if (--ch->clone == 0) {
+ if (--(*ch->clone) == 0) {
zend_llist_clean(&ch->to_free->str);
zend_llist_clean(&ch->to_free->post);
zend_hash_destroy(ch->to_free->slist);
efree(ch->to_free->slist);
efree(ch->to_free);
+ efree(ch->clone);
}
smart_str_free(&ch->handlers->write->buf);
--- /dev/null
+--TEST--
+Bug #70330 (Segmentation Fault with multiple "curl_copy_handle")
+--SKIPIF--
+<?php include 'skipif.inc'; ?>
+--FILE--
+<?php
+$t2 = curl_init();
+$t3 = curl_copy_handle($t2);
+$t3 = curl_copy_handle($t2);
+$t4 = curl_init();
+$t3 = curl_copy_handle($t4);
+$t5 = curl_init();
+$t6 = curl_copy_handle($t5);
+?>
+okey
+--EXPECT--
+okey