Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:117830 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 85831 invoked from network); 29 May 2022 18:07:54 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 29 May 2022 18:07:54 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 66D1F180211 for ; Sun, 29 May 2022 12:51:27 -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.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,HTML_MESSAGE,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_SOFTFAIL,STOX_BOUND_090909_B, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS36483 23.83.222.0/24 X-Spam-Virus: No X-Envelope-From: Received: from crocodile.ash.relay.mailchannels.net (crocodile.ash.relay.mailchannels.net [23.83.222.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sun, 29 May 2022 12:51:24 -0700 (PDT) X-Sender-Id: a2hosting|x-authuser|juliette@adviesenzo.nl Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 5B11D8011F8; Sun, 29 May 2022 19:51:21 +0000 (UTC) Received: from nlss2.a2hosting.com (unknown [127.0.0.6]) (Authenticated sender: a2hosting) by relay.mailchannels.net (Postfix) with ESMTPA id 277F2800DFA; Sun, 29 May 2022 19:51:20 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1653853880; a=rsa-sha256; cv=none; b=VCqwNGDUshmbrWQpJmWm28NmF3WQlQm5evlS1JGPEazzY4LamFEwTqyA3RGPdHg7MBmA0r sYNtGP6lDk7khybPqBDG+8ozB3hdJemmIviEU52s+KsG2BofFTJrKIhQ3K2Ns8m8F4Hyu5 KaN4QQLkweh6pi7aYL9S+XlqcKyQr/64arOWfvhtsPcFthUreEb1Br774be/we+ob7kF0H Y7iDMUqm1DWQA9Ehlk3K8EJqNUW7gR+SRODPYAVsNSxGm+KYKi+jpb1gbeWUMHZV8Kq3PR /HtWQy9MN3ydt2QTMeB9YvuQIGI/PbrvfVW3Wsfya6oHrDmstw3UcMiOtMJFww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1653853880; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references:dkim-signature; bh=r/0vMlHt90FnA+IsJrXrXjsr4aAb6yJsCZZwQEHDgZM=; b=ZQ698fj+K7/pt89jEDhU6e++FAZx/GVbTeLmXhs24wDA7zFMoy1o+3pfOdAXBdxQ3GQddM 3pq4okwU5bszRPBfTj+fcsY+ncgoNyB4Eq/HsAkPqh175T858Stkph+0tl3Z3YgXQznLnj Zswv2B3zNdhSNxcnroLWWKWBXFWIY3lFWO8PzWGP43LsoRUzT0xp+Vj3cFlr0z0TCqkP7/ r2NxI+4Ze3tYmcaPDqoWOZ197/7JQUP2M76t/NrBJJBhGfjpeD7639IJ2Icjw6AP8Y9hZ1 7t9SAq4/KpKNbCc+WOAZ62OIqHPZN8U8K8KsmDYhVm5zXq+DvPjR8hCs89ecUg== ARC-Authentication-Results: i=1; rspamd-54dc585458-82rpw; auth=pass smtp.auth=a2hosting smtp.mailfrom=php-internals_nospam@adviesenzo.nl X-Sender-Id: a2hosting|x-authuser|juliette@adviesenzo.nl X-MC-Relay: Neutral X-MailChannels-SenderId: a2hosting|x-authuser|juliette@adviesenzo.nl X-MailChannels-Auth-Id: a2hosting X-Stop-Skirt: 681cee6f3bdfacfb_1653853880851_3697504682 X-MC-Loop-Signature: 1653853880851:1304114549 X-MC-Ingress-Time: 1653853880851 Received: from nlss2.a2hosting.com (nlss2.a2hosting.com [209.124.66.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384) by 100.124.238.93 (trex/6.7.1); Sun, 29 May 2022 19:51:20 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=adviesenzo.nl; s=default; h=Content-Type:In-Reply-To:MIME-Version:Date: Message-ID:To:From:Cc:References:Subject:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=3LAv2Wjwa+NZZ1GaImDp67NcVvX9gK7bPTnFZReJpQk=; b=HtS+a4ROHXWXnk6q8wZE5PPGTR KEq85NJVe6xFqB829Zud87A+sw08LBNQKvZkLD4pjurr4nUHknvih3SOQJeA77mmaWk0arpVoivN9 bxHvP4YQcCQ5RhUHu6PpXBZW6UEZmHy49SwhUYh5PjQKPjnUkXbil3OrLcKFqz/Tixvk=; Received: from 86-154-178-143.ftth.glasoperator.nl ([143.178.154.86]:59381 helo=[192.168.1.104]) by nlss2.a2hosting.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.95) (envelope-from ) id 1nvOwY-00B4hp-EY; Sun, 29 May 2022 21:51:18 +0200 References: <627D3BCF.7020903@adviesenzo.nl> <628F685B.8090909@adviesenzo.nl> <6291DBBC.8020403@adviesenzo.nl> Cc: Dan Ackroyd To: internals@lists.php.net Message-ID: <6293CEB6.10209@adviesenzo.nl> Date: Sun, 29 May 2022 21:51:18 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------060409080502070608040002" X-AuthUser: juliette@adviesenzo.nl Subject: Re: [PHP-DEV] [Discussion] Expand deprecation notice scope for partially supported callables From: php-internals_nospam@adviesenzo.nl (Juliette Reinders Folmer) --------------060409080502070608040002 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Hi Dan, On 29-5-2022 17:34, Dan Ackroyd wrote: > Actually, I've just realised there is an error in the code in the RFC, > which might be based on a misconception caused by how terrible > callables are. In the code: > if (is_callable('static::methodName')) { > // For valid callbacks, this call will be executed in PHP 8.x, > // but will no longer execute in PHP 9.x. > static::methodName(); > } > The string based callable 'static::methodName' is not equivalent to > the syntax* based callable static::methodName(). > > ... This is actually not an error in the RFC, but an anonymized code sample based on real-life code patterns found in popular packages. While the syntaxes are not technically equivalent, functionally, they yield the same result, which is why this code pattern is not uncommon. It is exactly this type of code pattern - and the associated misconception leading to this code existing in real life code bases -, which started the initial discussion about the lack of deprecation notices for is_callable() and led to this RFC. >> for the practical implications of fixing the deprecations, >> there is no difference between the two. > People don't have to fix their code. Deprecations can sit there for as > long as the user likes. If a company decides that paying RedHat for > long term PHP 8.2 support, then they may choose to never fix these > deprecation warning and just silence them instead. > Which leads to a difference of, the deprecation notice when checking > with is_callable and using the callable can be suppressed reasonably > easily: > @is_callable('static::methodName') > @call_user_func('static::methodName', []); > And that's a reasonably sane** thing to do. But the deprecation notice > when passing callables around could happen across many pieces of code, > and there's not a good way of suppressing them, unless you just turn > off deprecation notices entirely. > With the deprecation notice where a user is checking, and a > deprecation notice where it is used, I don't see any value in extra > deprecation notices where the callable is being passed around. IMO that's a false argument as deprecation notices are not intended for people who don't intend to upgrade their PHP version. If there is no intention to upgrade to PHP 9.0, the much simpler solution would be to set `error_reporting` to `E_ALL & ~E_DEPRECATED`. Alternatively, a custom error handling could be registered which filters out all, or only a selection of, deprecation notices. Deprecation notices are for those people who _do_ want to upgrade to PHP 9.0 once it comes out and want to prepare their code base to be ready. And for those people, the `callable` type not throwing a deprecation notices means that for the "registered, but rarely called" callables, they will go from _nothing_ to a Fatal Error once PHP 9.0 comes round, which is exactly what this RFC tries to address. Either way, I do agree that this potential objection should be heard, so I have added an extra section to the "Discussion" section of the RFC in which I have summarized our discussion (so far) about this: https://wiki.php.net/rfc/partially-supported-callables-expand-deprecation-notices#these_additional_deprecation_notices_will_be_very_noisy >> do you still feel that splitting the vote in two is the best way to go ? > Yes, due to the deprecation notices on type-checks when calling > functions have a higher pain-to-utility that in the is_callable check. Fair enough, I will split the vote and have updated the RFC to show this. > I also like the deprecation notice on is_callable, as that notice will > be 'closer' to where the bad callable is coming from, so would be > easier to reason about. There's also a rare edge-cases where someone > has a callable that is only called in emergencies (like a disk running > out of space) and so might not have that happen for months. Having the > deprecation on is_callable would help those edge-cases a little. Just pointing out, the same thing can happen with the `callable` type - a callable being registered for an emergency (like a disk running out of space), but not being called for months. This example edge case is not limited to `is_callable()`. I hope the RFC update addresses your concerns sufficiently. If there are no further objections, I will open the vote. Smile, Juliette --------------060409080502070608040002--