summaryrefslogtreecommitdiff
path: root/ext/curl/interface.c
diff options
context:
space:
mode:
authorJulien Pauli <jpauli@php.net>2016-07-08 14:58:56 +0200
committerJulien Pauli <jpauli@php.net>2016-07-08 14:58:56 +0200
commit78d5783b6259889dc97a060be611ba9aca26d87f (patch)
treeec1393fa43bb60c14b54124b72a389f04dde052d /ext/curl/interface.c
parent0be13d2dc24f2802a231f92912ba5d089dad6676 (diff)
downloadphp-git-78d5783b6259889dc97a060be611ba9aca26d87f.tar.gz
Backported bug #71144 (Segmentation fault when using cURL with ZTS)
Diffstat (limited to 'ext/curl/interface.c')
-rw-r--r--ext/curl/interface.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/ext/curl/interface.c b/ext/curl/interface.c
index 19d8bb02b5..7e58c7f1e0 100644
--- a/ext/curl/interface.c
+++ b/ext/curl/interface.c
@@ -1925,7 +1925,9 @@ static void _php_curl_set_default_options(php_curl *ch)
curl_easy_setopt(ch->cp, CURLOPT_INFILE, (void *) ch);
curl_easy_setopt(ch->cp, CURLOPT_HEADERFUNCTION, curl_write_header);
curl_easy_setopt(ch->cp, CURLOPT_WRITEHEADER, (void *) ch);
+#if !defined(ZTS)
curl_easy_setopt(ch->cp, CURLOPT_DNS_USE_GLOBAL_CACHE, 1);
+#endif
curl_easy_setopt(ch->cp, CURLOPT_DNS_CACHE_TIMEOUT, 120);
curl_easy_setopt(ch->cp, CURLOPT_MAXREDIRS, 20); /* prevent infinite redirects */
@@ -2263,7 +2265,14 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue TSRMLS_DC)
return 1;
}
#endif
+# if defined(ZTS)
+ if (option == CURLOPT_DNS_USE_GLOBAL_CACHE) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "CURLOPT_DNS_USE_GLOBAL_CACHE cannot be activated when thread safety is enabled");
+ return 1;
+ }
+# endif
error = curl_easy_setopt(ch->cp, option, Z_LVAL_PP(zvalue));
+
break;
case CURLOPT_SAFE_UPLOAD:
convert_to_long_ex(zvalue);