Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:124665 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id 0AE3A1A00B7 for ; Sun, 28 Jul 2024 17:27:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1722187744; bh=gy+ImvkMqH6eE8w9q+JwQozjokdD+DpOjI2moz2CGdY=; h=From:Date:Subject:To:From; b=kpTyV9CuesNAlzPZ++LvqDxfbVSoOhCG+T3rbER8S59bMsjEULwcGe4lyT1n0BGsi zdCry75i2Gy4ZtPnH2dxPT9Ell8KtK1r78tm9N0LziperoMkNaLJBWqsiww2rYEBYQ dDBSH1p9kIjvK1GUeb00jTjrhhPAZn3RqMp9JfFj5ohp9/umZgG94wgwPe6Fki8Dvs vzN9XfAvBV1iBPrTfvt0wdXrMj7ASefonLMNKMb9nxpcjUCB8Y6G5X2PFCWxePdcOp CVZ4Nkb/ypr80weEj8aEYbA06/rNZt9QVZUTXmzFydMBCcjRgYXui7L0T1kz5WVg/6 qoJvXeKtbWWJg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 7C77818003A for ; Sun, 28 Jul 2024 17:29:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from forward102d.mail.yandex.net (forward102d.mail.yandex.net [178.154.239.213]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sun, 28 Jul 2024 17:29:01 +0000 (UTC) Received: from mail-nwsmtp-smtp-production-main-84.klg.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-84.klg.yp-c.yandex.net [IPv6:2a02:6b8:c42:3ca5:0:640:b181:0]) by forward102d.mail.yandex.net (Yandex) with ESMTPS id AADDD6097D for ; Sun, 28 Jul 2024 20:27:22 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-84.klg.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id LRXNGA8j1Gk0-Ru0LlTP8; Sun, 28 Jul 2024 20:27:21 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=php.watch; s=mail; t=1722187641; bh=gy+ImvkMqH6eE8w9q+JwQozjokdD+DpOjI2moz2CGdY=; h=To:Message-ID:Date:From:Subject; b=0z7BV9qTMBuU7Jg/tKwAbCkwAazGabCJ1fm5/7lFECd8baxKAXn/cTnoJl3bWS3qV zK+hagyV4eCn3TCeR8B0KYfQOjR2Ew7/BAtbvoZ3YxRqowboOSfe/nRnMe8Jy8jyzX 4H0Q7tCurxKTo2bxBYX8jdJPF+pZp3D6iej/2O3E= Authentication-Results: mail-nwsmtp-smtp-production-main-84.klg.yp-c.yandex.net; dkim=pass header.i=@php.watch Received: by mail-ed1-f51.google.com with SMTP id 4fb4d7f45d1cf-5a2ffc3447fso4240569a12.1 for ; Sun, 28 Jul 2024 10:27:21 -0700 (PDT) X-Gm-Message-State: AOJu0YxsannKgryXdAWEUKSQW//diggNu1q6DPB/xTxT2ExX7cMMSsKX pDdwW4S9/kBbO7V1SVrywhzhKELzPpnZ2gBluZ7fkKi+2tFyI/ZGMI80dBZSXfo25aRR4RUnQb8 s7oHbWGy0QHHHsxNtZ6149f1ugPE= X-Google-Smtp-Source: AGHT+IFANl8TjHr6wvcHYAO6kSOXthweAQ9NOslY8/oHHxLz8nXJKP2nGHz+8xC6qApfLiIjbQ0Swy96AvRKfPWsxbA= X-Received: by 2002:a50:d582:0:b0:5a1:40d9:6a46 with SMTP id 4fb4d7f45d1cf-5b0223da2a9mr3301937a12.36.1722187641079; Sun, 28 Jul 2024 10:27:21 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Date: Mon, 29 Jul 2024 00:26:53 +0700 X-Gmail-Original-Message-ID: Message-ID: Subject: [PHP-DEV] Deprecate ext/curl `CURLOPT_DNS_USE_GLOBAL_CACHE`? To: PHP internals Content-Type: text/plain; charset="UTF-8" From: ayesh@php.watch (Ayesh Karunaratne) Hello Internals, We recently bumped[^1] the minimum required libcurl version supported by the PHP Curl extension to 7.61.0. This aligned with the recent CentOS/RHEL 7, along with other major Linux distros that have already updated to a more recent version of libcurl. I'm writing to the Internals to get some feedback on deprecating a Curl option (a `CURLOPT` constant) that we support in PHP, but is removed on Curl 7.62 and later. Curl supported an option called `CURLOPT_DNS_USE_GLOBAL_CACHE`[^2] that enabled Curl to use a global cache for DNS queries. It was added in Curl 7.9.3 (2002 Jan), marked as obsolete soon after, deprecated in 7.11.1, and removed in Curl 7.62.0[^3] (2018 Oct). The reason is that this functionality was not thread-safe, and was not functional after a few releases. Users can still share DNS caches by reusing Curl handles or by copying the Curl handles. The PHP Curl extension does support this constant, and if PHP is built with thread-safety enabled, setting this option emits a warning with the text "CURLOPT_DNS_USE_GLOBAL_CACHE cannot be activated when thread safety is enabled". I would like to propose to either deprecate this constant, or no-op it. A few points I'd like to draw attention to are that: 1. We have had the no-op'd Curl options before. For example, the `CURLOPT_BINARYTRANSFER` constant deprecated in PHP 8.4[^4] had no effect since PHP 5.1.2. Before PHP 8.4, setting this option had no effect, and it did not trigger any deprecation notices[^5]. 2. GitHub code search[^6] shows that there are close to 1,200 usages of the constant. 3. In all Curl versions since 7.62 and even up until the latest 8.9.0, the `CURLOPT_DNS_USE_GLOBAL_CACHE` exists, but does not do anything[^7]. 4. Applications[^8] and the Curl extension[^9] have special handling to avoid setting this constant in ZTS. If we were to no-op, we could remove these extra handling and clean-up the code base. I'd like to know your opinions; should we deprecate it at the constant-level, or no-op it for now and deprecate in a later version? Thank you, Ayesh. [^1]: https://github.com/php/php-src/pull/13259 [^2]: https://curl.se/libcurl/c/CURLOPT_DNS_USE_GLOBAL_CACHE.html [^3]: https://curl.se/mail/lib-2018-09/0010.html [^4]: https://php.watch/versions/8.4/CURLOPT_BINARYTRANSFER-deprecated [^5]: https://github.com/php/php-src/pull/13114 [^6]: https://github.com/search?q=CURLOPT_DNS_USE_GLOBAL_CACHE+language%3APHP++NOT+path%3A%2F%5Eext%5C%2F%2F+NOT+repo%3AJetBrains%2Fphpstorm-stubs+NOT+repo%3Afacebook%2Fhhvm+NOT+repo%3Athecodingmachine%2Fsafe&type=code [^7]: https://github.com/curl/curl/blob/curl-8_9_0/lib/setopt.c#L254-L256 [^8]: https://github.com/symfony/symfony/blob/v7.1.3/src/Symfony/Component/HttpClient/CurlHttpClient.php#L168-L170 [^9]: https://github.com/php/php-src/blob/php-8.4.0alpha2/ext/curl/interface.c#L1106-L1108