diff options
author | Xinchen Hui <laruence@gmail.com> | 2015-12-19 00:29:19 +0800 |
---|---|---|
committer | Xinchen Hui <laruence@gmail.com> | 2015-12-19 00:29:19 +0800 |
commit | 8f9af36da35eef78728a46890ba5f1f114d7a0b0 (patch) | |
tree | ff7beaf0fb04a0a266999900ff608dc43536d067 | |
parent | 916f10ac315bcca24d546404771792cc54b2168e (diff) | |
download | php-git-8f9af36da35eef78728a46890ba5f1f114d7a0b0.tar.gz |
Fixed bug #71144 (Sementation fault when using cURL with ZTS)
-rw-r--r-- | NEWS | 4 | ||||
-rw-r--r-- | ext/curl/interface.c | 8 | ||||
-rw-r--r-- | ext/curl/tests/bug71144.phpt | 13 |
3 files changed, 25 insertions, 0 deletions
@@ -20,6 +20,10 @@ PHP NEWS (Nikita) . Fixed bug #52355 (Negating zero does not produce negative zero). (Andrea) +. CURL: + . Fixed bug #71144 (Sementation fault when using cURL with ZTS). + (Michael Maroszek, Laruence) + - DBA: . Fixed key leak with invalid resource. (Laruence) diff --git a/ext/curl/interface.c b/ext/curl/interface.c index f12a9e2492..7dd04a6d15 100644 --- a/ext/curl/interface.c +++ b/ext/curl/interface.c @@ -1851,7 +1851,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 */ @@ -2183,6 +2185,12 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{ 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, lval); break; case CURLOPT_SAFE_UPLOAD: diff --git a/ext/curl/tests/bug71144.phpt b/ext/curl/tests/bug71144.phpt new file mode 100644 index 0000000000..059cd63651 --- /dev/null +++ b/ext/curl/tests/bug71144.phpt @@ -0,0 +1,13 @@ +--TEST-- +Bug #71144 (Sementation fault when using cURL with ZTS) +--SKIPIF-- +<?php include 'skipif.inc'; ?> +<?php if (!PHP_ZTS) { print "skip only for zts build"; } ?> +--FILE-- +<?php +$ch = curl_init(); +var_dump(curl_setopt($ch, CURLOPT_DNS_USE_GLOBAL_CACHE, 1)); +?> +--EXPECTF-- +Warning: curl_setopt(): CURLOPT_DNS_USE_GLOBAL_CACHE cannot be activated when thread safety is enabled in %sbug71144.php on line %d +bool(false) |