Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127768 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 lists.php.net (Postfix) with ESMTPS id 628CB1A00BC for ; Fri, 27 Jun 2025 12:22:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1751026815; bh=ZIEir3OIgmayKFHUJFlpFDNhTPBWaZlIpQXTC/Pd+i0=; h=Date:Subject:To:References:From:In-Reply-To:From; b=emJs7+jzbciagaZUTlkZVSMMYl0rg07t/8h4NhIrQV7MrgRDRuSoXY7LZ9AkjeuoL bwqGn7Dc/wVohAdSWox6ZKZTDDw40S034j64dKKzq0V4jz95gincD1+Eo/uut30bWP aWk+khSeb3lSedc/HhM7LToT/6D78iefloaGWDnaHoppR9Khxue9r8Q5HTdOB0S26h 5zOattyQxO568l0F5CF3gjus9SRY9SmehqnPKIZMlHrb9rH0zHwUZ6OvsNSWV0tfB2 V5Dhvky7465R3QWrS31RjrTsC/E5uQntnEZcNGC5g8xlRy5vMESfS3NzCZwigF98xv phyDJ16Ur+NLA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 3EC7A180047 for ; Fri, 27 Jun 2025 12:20:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.4 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from mail-ed1-f49.google.com (mail-ed1-f49.google.com [209.85.208.49]) (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 ; Fri, 27 Jun 2025 12:20:13 +0000 (UTC) Received: by mail-ed1-f49.google.com with SMTP id 4fb4d7f45d1cf-60c01f70092so3370503a12.3 for ; Fri, 27 Jun 2025 05:22:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seld.be; s=google; t=1751026927; x=1751631727; darn=lists.php.net; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id:from :to:cc:subject:date:message-id:reply-to; bh=5TNpg7ThedAfAwUMJOXUpfbD86VNspPesODY11UyLDI=; b=iBgEudbMMRLNDaYQB00aWBa5K1hDU7rJpdsji0qpZbuUEu2DnXKUE2pt9oOcTKkflA rTkDp4vc1Y4fnFswxAVPT35mpC/EGDWTflIRgIR5EZL4JsMXU6CFgDF04koHRrwBJRCY Jd3j7+Lk/9P9tpePBCwtAjHCRUprAp4jPPgYZs+lZOBvrRXW145d72rdHo5R1ieyKCOk etIv8uJgzCCpMbdRmPe6cLQ5Fm9MjaU9dRZrxBgDPY102HBwx7TV1fcacpF8g8fsSNmC gSAcJ0oYNZ39++i5ttyR86VJHAlPPrBDODdK9hvRd0/gOSykMpmPrAy3DyCewi/jqccs QPAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751026927; x=1751631727; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=5TNpg7ThedAfAwUMJOXUpfbD86VNspPesODY11UyLDI=; b=mnNKc2XVcYR5zRb9hv0/oMbsiImeiqnE+Kfc5WaOanNpyj6Y0jwpe8nSbpNkH6DvFe 30F/HImvjMaQn4h2jTdFdOr9xYbBcU3530L2cDxjZCpoFiIO9uZrsSCvi1kGXiGvyyH0 bkdpmrs2J+qP6QFOiZ71/cWE7PoDq/H96TwZ/R+73fDJMdFkCEmP2cmgiL4T/zdB5Uxc cl/d7yUd8mLpxfi6A3FLaLRxgj+ZSPJDH7YghVp1up9bcbASf3joK7SxilAWn/R8abEy Jfw9HAabzPLsRPxbd51iwN85xc6seNmmxalpZ1rm1f0D8Hvq8xXy0QaMw8Y29tTOfEp/ buBw== X-Forwarded-Encrypted: i=1; AJvYcCUyuS4tQCiS75iXtrZiwCoMoHf5TFNuBWiJYTTIRGe/WQp8aEm4mvT9Cze2lKR6h/Hzsl2WESyozdc=@lists.php.net X-Gm-Message-State: AOJu0Yx610lO/0IF69A1Fy5PRCE8sIV/BIFwpvWZVkh2TthABh2YxN4W NdEpILyZ8SpRH53dPsQPaPw2z6kW7DLQX69X4qaVaJPQYbe+r6Nr6aLe9JLbvw9OEKJAhpqJv/G 8iUgJrSA= X-Gm-Gg: ASbGnctVEAXn52+aNT+1nZ8zPo9CBCydt6WiJIciE3bxRwG1adgJK7N6jELcUNI82kY UbL6ZaO4Fv55MA8nxRd3KoIVVe9rp77QNJLkX8j9x357A/ILo+YHYUuOH/Yc9g9+pIPfiP5V0RK xCgpnAMrPoVQH20zw+09BJUI5s7UCxv/8rrVlXuVZdqe5v69Lb3kP4RZGT4yd+JuwbFSYrYo+PU UmsdIloNzmACjNV0sveGik6jlu0kwixsN/mq3jWcMG1QVFgdvFXYp2VAXyK7s6igAEtj71rciS6 l0eO8dY0PPhdu2f77V8/6nn8YFBa4RpgUkSFGh3SSfhm/ymqwguncN063mXfepNNU2/cqT3YnFJ Wse53BadSRhEDTWEyZbmkdAC/5sTNzA== X-Google-Smtp-Source: AGHT+IFjIQLDnBmk82HxPdE8SgJixQIsiXJbRPk/d0Rx1HBIlt9DPgYlDWxyI7/Hp8RfgRmNCrFCHg== X-Received: by 2002:a05:6402:1ed0:b0:607:ec35:eb77 with SMTP id 4fb4d7f45d1cf-60c88de4b45mr2545052a12.28.1751026927091; Fri, 27 Jun 2025 05:22:07 -0700 (PDT) Received: from ?IPV6:2a02:168:4b6e:0:619e:2b57:4d97:8b84? ([2a02:168:4b6e:0:619e:2b57:4d97:8b84]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-60c831d5fecsm1407750a12.63.2025.06.27.05.22.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 27 Jun 2025 05:22:05 -0700 (PDT) Message-ID: Date: Fri, 27 Jun 2025 14:22:05 +0200 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PHP-DEV] [RFC][DISCUSSION] Object-oriented curl API v2 To: erictnorris@gmail.com, PHP internals References: Content-Language: fr In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit From: j.boggiano@seld.be (Jordi Boggiano) On 26.06.2025 18:25, Eric Norris wrote: > - uses enumerations for curl options and other curl constants Overall I think the RFC is a good opportunity to clean up a few legacy oddities in the curl API, but I need to throw in my 2c about enum usage here, as someone that has actually implemented some complexish curl-based client [1]. Currently the API is:     curl_setopt($h, CURLOPT_SMTH, 3); Now moving this into multiple enums to me brings one major issue, that I first have to think about which type the option has to then know on which enum I find it. I understand this brings type safety on the value side if you have multiple setOptionInt etc, but that does not seem worth the trade-off to me. Type safety can already be done in static analyzers as they can see which option you pass in, they know which value should be allowed. Then on top of that, assuming we'd put all options in one enum.. I am still wondering what the added value is compared to simply having the global constants (they could be namespaced if anything...). It's longer to type, and does not provide any better autocompletion. \Curl\Option::ConnectTimeout vs CURLOPT_CONNECT_TIMEOUT sounds ok to me if people feel strongly pro-enum, but I do really hope it is then a single enum + setOption() call. Best, Jordi [1] https://github.com/composer/composer/blob/main/src/Composer/Util/Http/CurlDownloader.php Jordi Boggiano @seldaek - https://seld.be