php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #71144
Patch ZTS1 revision 2015-12-16 22:26 UTC by maroszek at gmx dot net

Patch ZTS1 for cURL related Bug #71144

Patch version 2015-12-16 22:26 UTC

Return to Bug #71144 | Download this patch
Patch Revisions:

Developer: maroszek@gmx.net

commit 853bacf220e0b95ca6a6c795cc14f98cb77aa395
Author: Michael Maroszek <maroszek@gmx.net>
Date:   Wed Dec 16 23:13:15 2015 +0100

    Do not allow using CURLOPT_DNS_USE_GLOBAL_CACHE when ZTS is enabled

diff --git a/ext/curl/interface.c b/ext/curl/interface.c
index f12a9e24..3d4aabe 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 */
 
@@ -2182,6 +2184,10 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
 					php_error_docref(NULL, E_WARNING, "CURLPROTO_FILE cannot be activated when an open_basedir is set");
 					return 1;
 			}
+			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;
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Dec 03 17:01:29 2024 UTC