Req #75751 [Opn]: disabling CURLOPT_DNS_USE_GLOBAL_CACHE reports a warning
| From: | cmb@php.net | Date: | Tue, 02 Jan 2018 13:03:51 +0000 |
| Subject: | Req #75751 [Opn]: disabling CURLOPT_DNS_USE_GLOBAL_CACHE reports a warning | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-213352@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=75751&edit=1
ID: 75751
Updated by: cmb@php.net
Reported by: pavel dot madr at gmail dot com
Summary: disabling CURLOPT_DNS_USE_GLOBAL_CACHE reports a
warning
Status: Open
Type: Feature/Change Request
Package: cURL related
Operating System: All
PHP Version: 7.2.0
Block user comment: N
Private report: N
New Comment:
Considering that the cURL documentation states[1]:
| Subject for removal in the future. Do not use!
I think it would be best to deprecate this option, and point users
to use the following instead:
curl_share_setopt($sh, CURLSHOPT_SHARE, CURL_LOCK_DATA_DNS);
A deprecation would likely require the RFC process[2], though.
[1] <https://curl.haxx.se/libcurl/c/CURLOPT_DNS_USE_GLOBAL_CACHE.html#AVAILABILITY>
[2] <https://wiki.php.net/rfc/howto>
Previous Comments:
------------------------------------------------------------------------
[2018-01-02 09:35:32] spam2 at rhsoft dot net
> So it would be better to remove it completely from
> PHP or set to FALSE be default for both modes
for sure not remove it!
i even wrote abugreport some months ago because a loop of requests to the same local domain
triggered rate-limits of the nameserver with file_get_contents() while curl was fine and the reason
is that DNS cache
virtually nobody is using ZTS in production so don't sacrifice PHP because of it's
existence
------------------------------------------------------------------------
[2018-01-02 09:23:44] pavel dot madr at gmail dot com
Description:
------------
This line of code produces warning in PHP compiled with ZTS.
$c = curl_init();
curl_setopt($c, CURLOPT_DNS_USE_GLOBAL_CACHE, false);
It's perfectly ok to call this method with false argument and no warning should appear. The
warning should appear only when true is used for the argument:
curl_setopt($c, CURLOPT_DNS_USE_GLOBAL_CACHE, true);
Also the documentation is not exact - "This option is not thread-safe and is enabled by
default."
CURLOPT_DNS_USE_GLOBAL_CACHE is FALSE by default in ZTS mode and TRUE in non-ZTS mode.
According to the cUrl documentation this flag should not be used.
https://curl.haxx.se/libcurl/c/CURLOPT_DNS_USE_GLOBAL_CACHE.html
So it would be better to remove it completely from PHP or set to FALSE be default for both modes.
The attached patch solves just appearance of the warning.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=75751&edit=1