Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:117371 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 47485 invoked from network); 18 Mar 2022 12:12:09 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 18 Mar 2022 12:12:09 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 3FFE31804D0 for ; Fri, 18 Mar 2022 06:37:38 -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=-0.9 required=5.0 tests=BAYES_00,BODY_8BITS, DKIM_SIGNED,DKIM_VALID,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM, NICE_REPLY_A,RCVD_IN_DNSWL_LOW,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: AS8560 212.227.0.0/16 X-Spam-Virus: No X-Envelope-From: Received: from mout.gmx.net (mout.gmx.net [212.227.17.22]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 18 Mar 2022 06:37:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1647610656; bh=UNaRhGh2IPmcH3SHmue42CJKIUgIkVTbLqfZ63QsZik=; h=X-UI-Sender-Class:Date:Subject:To:References:From:In-Reply-To; b=iE7teQqPiYhWcSswIiTV/zslaDWTF3nl8vYSfgGZWrPYkghkzMZ1SeaVnbqTEx6K6 6uLtOfASch6Wrf5RfNF+clPGrikHsXdW8U7o4DtxQ3afrKopG1YfUwUNjxrbYrhojX yjyY+2gF0x942v/v9SFpQs93vBZCTajHSn8r0BAc= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.2.130] ([79.251.202.27]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MtfJX-1oNqr10EVL-00v9fG; Fri, 18 Mar 2022 14:37:36 +0100 Message-ID: <70c5d418-7472-7f87-dc2c-e1a60ee09df6@gmx.de> Date: Fri, 18 Mar 2022 14:37:36 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Content-Language: de-DE To: Juliette Reinders Folmer , PHP internals References: <62317B01.90907@adviesenzo.nl> In-Reply-To: <62317B01.90907@adviesenzo.nl> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:iFCrWraNTGz8WGxIL1nLVHFG0MQH/OqxsewHkkv8ZvXsh9voN4t 9VnSc+mq9CT5nIY77dfT31Q5engPYVuYRKYmTboALLeT+O0ytWMT1ThG5G8+/dt0tH3FaG6 jQsabkZl/Opq+u9opGoKCj86KdCUProozgyUdhKVmRrEQTcPbGWG1Cf5Q8hvoDTLPh+MA0l oWDd0BCxA7d+HTTUXBnGg== X-UI-Out-Filterresults: notjunk:1;V03:K0:jW2jsBnxopI=:RZqXu4xniyr4Tp9h2pwL0d 7X+YvIvQmoc/uLSAJifoCo6fQK3DXf0isw9sOPW5gJBOaDBIx1Sufy4Lj4zQhTu6NxDJadnLa vuK0xoHcsy7VYivh/u43Omy9nVGOgT1ziNZB82/7z86dIIFORdKq5NGtWAjhbvLDqTvy7esrr sE1EAcDnviESRGAwRxk35ySRmExhhW7eFcw++o6LarOrUaF54nqi5HBVVSCw5ROOrpSsXX/Sq csBDfyxe3uOTMVb+8VDBT1TJTF1CPeqVeo8C/hv2XlNxFss5yXAeH6MTAYKgFSrgGDE/WLQS+ ClS2pvxyUGlFNzxJNe534i9hxZ/+bq1g6e78NNp3MKwUmJcRzfibJPY2tbeXd5pKYmOEMCc8m 8uaaO+q4V6EPOwpT2dvaZh6WWEfJCNCPJLpEC6IqYykBoUlZKYOx45D+xxPD08NnLZ4PvB4Vb hhwAAImSighwo881cpnszmnfbLXcGVNVBwMQJKKQsdNaIBPX9wK4qjWKhxaHxvbespa1Xbc/u BKFgJhb3t9anja8CtDmy8IRBAksRR8Jk1ykGQo0aLUNd46Af6906BXhNO83AjOLQ3BqNttUN8 o9kNI1TK1zlz/LQ1aeM9nqFmnzfxGWi6JtYD+/essrZASDpfnWvr/YWXY1FUAcHWuCP/1f/Ue KN0K3r2YAy7QVo0LEMk0Litj2QHybV4aIVgeerDCP/xrt5xiswiOkWEqUWFlkZ5MjxpMzQeIo fYHwgMFSQRLpSZlSv0ixAbFFsjT0cZyQiCPWXGxpVepMlmjGyJfxbti6GV0QqVU+L4Cc3TMd2 FXaGrtXFQkz0adYmWjfdtfWPdP2oLWAByxireNxATuWr5JRdrND8/8Fg6hr7xsRqcxhKroNdi Yqevxb7BT+68256aFbXGqS+zNtESyAexmwqy8UrA1Rprb2stqU8cQrL+ycp5ELrr0rJ/XtfQZ TM3haDRDfjNl9ovE1+x24NHqcdkh39j6atZHY4JaL5xvNeKE/DIt9k3bqyJ8rOjh0kqdPXCIc i7iO9oshWEv+kQnzgQvWg2BGgO/ZyhofudgtdDoLuMFWLSktrEMleZIaC7Rm8J1+Q0cukqQ9c t7KX+AajO50MEQ= Subject: Re: Deprecated partially supported callables: should is_callable() throwa deprecation notice ? From: cmbecker69@gmx.de ("Christoph M. Becker") On 16.03.2022 at 06:52, Juliette Reinders Folmer wrote: > I've just been looking in detail at the Partially Supported Callables > deprecation RFC: > https://wiki.php.net/rfc/deprecate_partially_supported_callables > > The RFC explicitly excludes the `is_callable()` function and the > `callable` type from throwing deprecation notices. > >> The |is_callable()| function and |callable| type remain side-effect >> free and do not throw a deprecation warning. They will continue to >> accept these callables until support is removed entirely. > > While I can fully support this for the `callable` type, I wonder if the > decision to not throw a deprecation on use in `is_callable()` is the > right one (though I understand the desire to keep it side-effect free). > > Consider these code samples: > > =C2=A0 function foo(callable $callback) {} > =C2=A0 foo('static::method'); > > This function call not throwing a deprecation is not problematic as in > PHP 9.0 the function will start throwing a TypeError. > > =C2=A0 if (is_callable('static::method')) { > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 static::method(); > =C2=A0 } > > The second code sample, however, is problematic, as in PHP 9.0, the > behaviour of this code will be silently reversed for those callbacks > which would previously result in `is_callable()` returning true, which > makes this a potentially dangerous change without deprecation notice. > > Would anyone care to enlighten me as to whether this was given due > consideration ? Frankly, I don't know. Apparently, there was almost no discussion about that RFC. Part of the reasoning to not raise E_DEPRECATED when calling is_callable() was likely the typical use case $callable =3D =E2=80=A6; if (is_callable($callable)) { call_user_func($callable); } what would report the deprecation when actually calling the callable. Not sure what to do regarding your given use case(s). =2D- Christoph M. Becker