Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:120180 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 49442 invoked from network); 2 May 2023 12:20:35 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 2 May 2023 12:20:35 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 2935F18054B for ; Tue, 2 May 2023 05:20:34 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-oi1-f176.google.com (mail-oi1-f176.google.com [209.85.167.176]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 2 May 2023 05:20:33 -0700 (PDT) Received: by mail-oi1-f176.google.com with SMTP id 5614622812f47-38dec65ab50so2257341b6e.2 for ; Tue, 02 May 2023 05:20:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683030033; x=1685622033; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=lI5HoZXHyFmNepCPvIh9SrDP0slw7IDQ1I6kNIUBlPo=; b=NmTuiSEhu9PlA1FKDk5NTM2dfPag2bKh409zi6oVSslQA5iFJSOFuCUXUsNSTFf4Jn TLw0ti0XcMRdPSB82DCbNp0N2YrHqni1DIFR+duSpqGfvixcyAR/iP4+DCnwJaCbrHhl ytsjecXPCVPi90p+NzqPrFSJeFkpdXaFlY0kXWft1SkETeF9mWCHX1aF+wQrYv4tuHyy rwVgKnLBX8F6+PibxF/dP4n4gyKvCj4eD0axoQHCpZKe2sMdYLOeTD4cgvSlTeBsOY0M MeXR2kW9NRkJF7yMyCMfWmFWT+khHl82ZHEuQZbrt6NEBHssCTM/iG6XIxj44GFPFPLp /eWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683030033; x=1685622033; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=lI5HoZXHyFmNepCPvIh9SrDP0slw7IDQ1I6kNIUBlPo=; b=SMmV7B5O39s88kAPRQqhEewLF7XS9jXJ595Iq/TRGFR8iVWqBNGnaYu0aTqyCVRuOT d2SrNoqOD5VAMZxUGHM3C64KRmoKwEtNUDwLFkqKC/hnOuFpx3rEe2IwUPFQAiTfy1QO BblKbIPiQ0wQ6QEIWhaxSX+fyqWi6a5envFlabLIJ+Ymma6epR3ZJKhfu05Glu+OfGo1 13MlVA/5+NzK9RL4aQ8AN4vEd6/CmyvHum6a+oZK/1yY3QBmdqgnniMEFsnos8Jfot0q Eu5M5T972SdKinxi1IRzM9ZNdG3lllH89iUX2zSP1LVcz1ZKDCmCEk2XqV0Azzbt0JYt HELg== X-Gm-Message-State: AC+VfDytnIieBuIzh0qaeT6FuNxMN85GR9C6VAIfQpZjKoxL4Z+/e+ki pZjC08Isa4lSftJvb+NwF8LUQGF6Xrd+hXDSzKucLTjE0fpzXw== X-Google-Smtp-Source: ACHHUZ7kQE53ZXMY2Q+gYyOv9WM7Gf3fpWPcIz92Zz7lH9zvgKH9R2vkDt/1hSAI+XS0NCun1x7z9iq8agP/aUh5Njw= X-Received: by 2002:a05:6808:138f:b0:392:1cd4:5c21 with SMTP id c15-20020a056808138f00b003921cd45c21mr2959406oiw.8.1683030032948; Tue, 02 May 2023 05:20:32 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 2 May 2023 14:20:21 +0200 Message-ID: To: Rowan Tommins Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary="00000000000042a5e305fab4f7a1" Subject: Re: [PHP-DEV] [RFC] [Discussion] Deprecate functions with overloaded signatures From: kocsismate90@gmail.com (=?UTF-8?B?TcOhdMOpIEtvY3Npcw==?=) --00000000000042a5e305fab4f7a1 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Rowan, As Kamil says, a potential 1-year deprecation is probably not enough, > and we need to keep in mind that many libraries and applications need to > support multiple versions of PHP at once. If they are to become errors > in 9.0, there should be some way to write code that will run on both 8.0 > and 9.0. > Yes, I agree that we should make the upgrade path of libraries as easy as possible, and I also agree that probably a 1-year deprecation is not enough.. althoug= h the suggested alternatives would be available 2 years in advance of the removal so this would allow a 2 year window for fixing code using the deprecated functionality. > The only ones in this list I can see that being easy for are > assert_options (you can write a polyfill for the new assert_set_option, > and switch all code to use that), and get_class() / get_parent_class() > (you can start passing $this right away). > As far as I see there are more deprecations which are easy to fix. In order to see the whole picture better, let's group the functions based on how a possible upgrade path would look like: - With existing suggested alternative: - get_class() and get_parent_class() - pg_fetch_result(), pg_field_prtlen(), and pg_field_is_null() - Phar::setStub() - ReflectionMethod::__construct() - ReflectionProperty::setValue() - session_set_save_handler() (because the OO and procedural style are interchangeable) - stream_context_set_option() - Polyfillable: - assert_options() - ldap_connect() - ldap_exop() - Requires conditional version check: - DatePeriod::__construct() - IntlCalendar::set() - IntlGregorianCalendar::__construct() (I intentionally did not include the FFI related methods, since this section is TBD) As it can be seen, most deprecations have an existing alternative. The 2nd category (polyfillable ones) mostly contains very little used functions, especially because the deprecation of ldap_connect() only affects PHP compiled with OracleLDAP. The category which requires conditional PHP version checks is indeed the most problematic one. Probably it's not a surprise that it only includes methods because it's not possible to polyfill methods according to my knowledge. The good news is that IntlCalendar::set() and IntlGregorianCalendar::__construct() seem to be very little used functionality. So in my opinion, DatePeriod::__construct() has the worst upgrade path, the rest are either easy or shouldn't cause much issues. Since the constructor is set to be removed completely based on Derick's preference, we should discuss with him whether it's worth to leave the public function __construct(DateTimeInterface $start, DateInterval $interval, DateTimeInterface $end, int $options =3D 0) {} signature alive so that people can change their code to use this instead of the other two signatures. I have particular concerns about session_set_save_handler. The impact is > hard to estimate, because it will be used directly in applications more > often than in libraries. The multiple parameter signature is much older, > dating back to PHP 4, with the object form added only in PHP 5.4. That > may seem a long time ago, but there is currently no incentive to change > existing code between the styles, and doing so requires a reasonable > amount of work. > Yes, but changing session_set_save_handler() to session_set_save_handlers() should be a reasonably small effort, isn't it? I understand that it's going to affect lots of codebases, however other PHP 8.x deprecations are much more difficult to fix than this one would be. > On a different point, I think "assert_options" is a peculiar name for > either setting or getting a single option, and would suggest it be > replaced with two new functions, assert_get_option and > assert_set_option. Replacing both variants also makes it easier for > users to find everywhere they've used it, and polyfill both variants, > rather than having to examine each. > Yes, I agree that the assert_options() name is at least weird but I wouldn't like to include changes into this RFC which are not strictly related to overloaded signatures. Just like in case of implode(), the 1-parameter version of assert_options() could be added to the PHP 8.3/8.4 deprecations RFC though. Regards, M=C3=A1t=C3=A9 --00000000000042a5e305fab4f7a1--