Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:122380 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 531481ADA70 for ; Thu, 15 Feb 2024 10:15:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1707992111; bh=zAGPq+l0JbvRaE1kz+UKFBp5/biqshPUe5x44lbKGaQ=; h=Date:From:To:Cc:In-Reply-To:References:Subject:From; b=QBo+Jv1AePQaT6SZ+y8eqUImK+GW/hOpskOUXMeooN93t7/ijima8j3rlXmiBDS2O p/iMIzJ1QsYtrJd92V5zGg9OgHNGUKD7CtOE8/0KHQ+Uvz8svD4ecfjoP41wIAwFnt 6iyiPjWKMvhVQzoUFikAk0laVypgDlMR1N4LThTO2EVG/YNAPuX3X9Ufr87qLtHR3p XP5nCMzC234ucKzVVVnLG23QL+WGTffUjbpRLOsXdhfQ5T5qwZIABYTNgPecdwZMSr 6gOaZPsMxfa5IO3uJUx00UvmfjnikOJlY4NfaA4d3dlWuzrCoXY+/2R/j1/XA94Tld H1Ci3JkRuNahA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 766B818069B; Thu, 15 Feb 2024 02:15:08 -0800 (PST) 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.2 required=5.0 tests=BAYES_40,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.135]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS; Thu, 15 Feb 2024 02:15:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=thomasbley.de; s=s1-ionos; t=1707992104; x=1708596904; i=mails@thomasbley.de; bh=zAGPq+l0JbvRaE1kz+UKFBp5/biqshPUe5x44lbKGaQ=; h=X-UI-Sender-Class:Date:From:To:Cc:In-Reply-To:References: Subject; b=ziKjaAmsIIzvgSm7baSfzxGuTO8Pk6pxdn9iW0+2zVApKN2erk9SUmyOh0HQt/04 dFQx9uFGgZWwoWDtK80wN+zb5aWbj4Y/l2y8oO3xBtykKF72YgdNOzQtigqdmjBZk Tg/8HIswLp25da3i+uB+af6WdiGlCvXjm4dfoDElmZYGX8+NVHsNnKUHYTQQ1FEUY JoZFlg7IbnYCHHjLJ/N2DUurZn177W1feDKNMdAhNbKyAzqCaXPIbQBbBkhvcuoZp RszP0gnvG1zWtI30Ejl4C+pgiwLoIyIG/zuTzXSDjY0ypC8v/652154LJFl2xUcQ6 /Qz9tJw7NtryCTSzcw== X-UI-Sender-Class: 55c96926-9e95-11ee-ae09-1f7a4046a0f6 Received: from oxbaltgw64.schlund.de ([172.19.246.151]) by mrelayeu.kundenserver.de (mreue011 [172.19.35.3]) with ESMTPSA (Nemesis) id 1M2NqA-1rXogA1Uhq-003vDk; Thu, 15 Feb 2024 11:15:04 +0100 Date: Thu, 15 Feb 2024 11:15:04 +0100 (CET) To: Sara Golemon , PHP internals Cc: =?UTF-8?Q?Ond=C5=99ej_Mirtes?= Message-ID: <1887980764.719082.1707992104112@email.ionos.de> In-Reply-To: References: Subject: Re: [RFC] OOP API for cURL extension Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Priority: 3 Importance: Normal X-Mailer: Open-Xchange Mailer v7.10.6-Rev59 X-Originating-Client: com.openexchange.ox.gui.dhtml X-Provags-ID: V03:K1:HxmwjXQwQmjaHi0pKFgGb8LqGcJLQfUqpAL3Sj+aBxSJ/AsIjGU R9X+iN0Bicu1wwV7Fvz9XIMtojGmjyYqb6JPLuY8h41He9pg/Uutv8q4cqP7cLK3/XrzCrt AaDr/XQvA23dYSgB7MgHp7x/R0svxjm80fD7GXceC14+dOSle9kgAU9tcSjhyj05e/jkLcA 5MQvrlWacXt6hzHhiB9aA== UI-OutboundReport: notjunk:1;M01:P0:sKKk9Vo6R+c=;VuYWziWy1+qC/Wl4dOrxiZN9s5X ja1e2Eq+obdJfPOo8xK79UQ4+bX0G3ash5KEo/BHtSH9sncP90J64P/PF5j27yByuQ8ZtdC1y c7TVd1nifNR4g69hhDBe/ODstfHNeET8Em+fMOjDcmBLiwDrDSj6rN+6AFxd4UkaCqW9gVHUQ wAQP+qfXRBxqWbIUgsUQuZCPVY9igcMMcgXf0PVkSSaxskTSrz7lYq++Kif60kAvAcguwi1Ur FJl8yolCWnTJn1iAxf6k7mxGF1ewstodZJLi35UYPjXwMQyqhvwEUKr20+KaRMx9pOgm/geCn /vHz+CRlPLjHYu5k8dwPMIjrWbPBgSr/G9IqKH0gwAJ7/5/njOFvpT1739QSSell6sSdyDYvW LnhUQt2DauBr+Qbr2/NA0ZrYvigbm+BDM8EDUVaR9HkI3+4qlSIw1MsLlulaope/imGo5REln GJ8weDUYVMC9w0TCWOEa5lt9EOm8kS0MJzJPBnnKJrb5cjIgzfjtWOopUPs+VgT9INkraW9B6 PZehRNsax8QElYjlLKkAWhXo0LzSA3AI+einib4wN+0zX1ehYsWIHchDndh/LrqwYLVRtod5z c8HlmdZA6khW10Q28Ki/l6CIWsftQpN/Tt9ezsp+xjUSPeHFnRZIpmEuYmDKUDAgoOVrqUaEh mO+UX9U+CK8QcqP9VngCjBn6veG1Ld5bigPzB/kk5+DkpZb5z1Pyp+msXGbFFW1kTYfM7QMwt Q4syNy+TUbI54H/NsoOmv0KYrcjWwrFrA== From: mails@thomasbley.de (Thomas Bley) > Sara Golemon hat am 14.02.2024 19:47 CET geschrieben: > > > Good afternoon folks, I'd like to open discussion on adding OOP APIs to = the cURL extension. > https://wiki.php.net/rfc/curl-oop > > This has been a long standing bug-bear of mine, and I think its time has= come. > > try { > (new \CurlHandle)->setOpt(YOUR_VOTE, true)->exec(); > } catch (\CurlHandleException $ex) { > assert(false); // Why not?! > } > > -Sara Thanks a lot for the rfc. Regarding secure default options, I'd like to mention this article: https://php.watch/articles/php-curl-security-hardening Since CurlHandle::setOpt() no longer returns true on success, it would be = good to have an example in the RFC how error handling should be implemente= d in user land regarding setting invalid, deprecated or unknown options (e= .g. SSLVERSION received some changes over the years: https://curl.se/libcu= rl/c/CURLOPT_SSLVERSION.html). Also I'd prefer to have class constants for the options, e.g. CURLOPT::TIM= EOUT instead of CURLOPT_TIMEOUT. Static code analysis for curl_getinfo() is currently difficult to implemen= t (see https://github.com/phpstan/phpstan-src/blob/1.11.x/src/Type/Php/Cur= lGetinfoFunctionDynamicReturnTypeExtension.php). So I'd suggest adding sth= . like curl_getinfo_all():CurlInfo-Class if possible. Maybe Ondrej also has some suggestions regarding a more object oriented ve= rsion or curl_setopt(CurlOption-Class)? (see https://github.com/phpstan/ph= pstan-src/blob/1.11.x/src/Reflection/ParametersAcceptorSelector.php#L562) Regards Thomas