Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:117794 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 72501 invoked from network); 26 May 2022 16:40:34 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 26 May 2022 16:40:34 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 9A3D7180212 for ; Thu, 26 May 2022 11:23:21 -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,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE, 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-vk1-f174.google.com (mail-vk1-f174.google.com [209.85.221.174]) (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 ; Thu, 26 May 2022 11:23:21 -0700 (PDT) Received: by mail-vk1-f174.google.com with SMTP id b81so1077156vkf.1 for ; Thu, 26 May 2022 11:23:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=basereality-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=fbwIbyIS8TzrtTTsAbhLYrCETh3ejhBoHY9YZCzlpQ4=; b=BdGTizI2FOW2RTCpSAZxPkxclvwu2ywSCdIRGZzesD92uOS5ThfZ0FA33vIjpuA1x1 OmWi7H0pWNjKlJipH4FW2dJLOtBI9zw4MADgK7aMSQJZV6HQlXF2EJVZSws47NyQS7HC a6rDNSsCO/Fggb/7RnabjIzD/IixZmeqsWzEHfZO7Ox2vDq2s4vzQcXkyx+NaUshWHPJ mjtTsrSGmVBHo4u/O3DPRqML5uxfho9HrvZmLMnjaFdhSYdltr67RGa2svC1jUyKvbIk df0SnLfOCN8KM/GpdmgpDQprJJfxG9mWhzu0iXbjn3ngznQDUoBcJeKsG/lHVmGcAEYw Dj1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=fbwIbyIS8TzrtTTsAbhLYrCETh3ejhBoHY9YZCzlpQ4=; b=uH/5ePkHcLAe3X+avKhGUKJNElc/SOXXoGdI+2Q1yZbC0MXCpSnfs6UDLQ+j+ZnIJO a46ul0/M3BwpWsdhBXuMAq46PtjwcfG9CyAHb/6+5kNe8Phozx8x6FnOaitY7QPDAx84 ugvZbIEzzJzZ1qRFvEQKDFTrZdUmw08zbczV4QUk9RCGz+PNapJiXYVz+xb98a+jnsbi PiSYWYPtN+5sD229Hl4hbU/Iy2ZP164/YCz0kh9DQMYuUVcdgOHXoMqETuMX8MYn8bbU zwtGJEL+1pqeTlxyhqgJtCmJqOPX/GJN+OF80txZ/ELSLaM2GJkUlLKrN2V5SoqI6tmZ C/yw== X-Gm-Message-State: AOAM5339XECjcGI3tyZGNxeK5bUDsVDH2u/AeWnzixzjsUlbgi4a3h26 u9OaThb+vNh3abbncV/ZM+2/UL9eNIEGbLwW8MZ2EA== X-Google-Smtp-Source: ABdhPJyexaX189G99T5a1Mqr+0DOYTBDW1IWvg8h1NMUqPbj7gH7Mue1GROVLKXnG4S/ZkiBGa54lXGOLkh5hZteKcI= X-Received: by 2002:a1f:988f:0:b0:356:f60b:9897 with SMTP id a137-20020a1f988f000000b00356f60b9897mr15258738vke.28.1653589400167; Thu, 26 May 2022 11:23:20 -0700 (PDT) MIME-Version: 1.0 References: <627D3BCF.7020903@adviesenzo.nl> <628F685B.8090909@adviesenzo.nl> In-Reply-To: <628F685B.8090909@adviesenzo.nl> Date: Thu, 26 May 2022 19:23:08 +0100 Message-ID: To: Juliette Reinders Folmer Cc: internals@lists.php.net Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] Re: ***SPAM*** [PHP-DEV] [Discussion] Expand deprecation notice scope for partially supported callables From: Danack@basereality.com (Dan Ackroyd) Hey Julie, On Thu, 26 May 2022 at 12:45, Juliette Reinders Folmer wrote: > > I propose to open the vote on this RFC tomorrow. Before you open the vote, please could you split the voting into two, one for the is_callable, and one for the callable type check? Rowan wrote in https://news-web.php.net/php.internals/117670: > is that passing "99 red balloons" to an "int" > parameter raised an E_NOTICE in PHP 7.x, so a "callable" parameter > raising an E_DEPRECATED should be fine. There's one issue. When "99 red balloons" is coerced to an int, that is done once, and then any further int type check will pass. For callables, it's pretty common to pass them down a stack of code, e.g. similar to: function foo(callable $fn, $data) { $fn($data); } function bar(callable $fn, $data) { return foo($fn); } function quux(callable $fn, $data) { return bar($fn, $data); } function main(array $data) { $fn = get_callable_from_input(); if (is_callable($fn) === false) { // give some error. return; } quux($data); } As far as I understand it, this code would give a deprecation notice for each call level, which seems quite undesirable. Particularly if the callable is being used in a loop. Also, without a patch it's hard to guess what performance impact this would have. I doubt it would be huge, but it probably wouldn't be zero either. Performance wouldn't matter for is_callable, as that is typically only done once per callable, but callable type checks are done continuously. cheers Dan Ack