Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127835 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 BF3A01A00BC for ; Wed, 2 Jul 2025 15:04:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1751468564; bh=K2eub1fo/mIuZ4pbstKoLCpCPVX+QH6qTBeZEIUwZL4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=KuV9w08PSxQOeOq/1C+DHGCnnLRiqXGlbX0ADc4PpI67FV0L/RA4z4pV8Nqa+RMj4 bnvgojFKvTPwKnK73bRTgsL/ipgg7FddL2ecuLHOyxbZLLupl+0d8yW3fayWQkxvFi niQ2hW6uuS4UNcJa97k03nOqLKPkF8BcO7/BhKOcwjyBYcSZjvSwix6VEhY7X/L9jC TVnxbFMytf5AnahYYc8Uzk5TQIYa5bRLZfqg3MSGJo0sEBMFuLuBf/oMd/7rh4Q0+k GiJphmqR0zGi/iJUcbVjutkv13vf5XovbIV528p4lkJpWj4uIBgw1OQ1u2tQwDv++E KtRkk3avo6amg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id D23C01801D6 for ; Wed, 2 Jul 2025 15:02:43 +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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,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 chrono.xqk7.com (chrono.xqk7.com [176.9.45.72]) (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 ; Wed, 2 Jul 2025 15:02:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1751468674; bh=440wCm24qCgGPlTbYtVQfeEpJ8xtW2hLcJRky+BdMb4=; h=MIME-Version:Date:From:To:Cc:Subject:In-Reply-To:References: Message-ID:Content-Type:from:to:cc:subject:message-id; b=h1EberUh73pjOl855Jlqw+3bQcA8UZtEmoLCia9biuCHEXuO3KOUwYbEoTU8nucbV 3X66IWcQp65GuuiBuBdJMCK+msQIbkXBAkIXiGhjBvWELnR9xFIKvVuPjPQLfi0Peg 0VOCwl6UINKQQoJhJCXgQZ0bqOqrqtwKxXqWf0ngt9tMrux3V7EdH98zTwri984uWJ T31BnKHCRpVSrfefJeJtdb6xtTsK/09d0CiLKtjStKC//dbKwp/8VhOj7g3C6lmZh2 zDfBy1+hPgt34Js1UKfr4+Tw8qL1VT4olFtfD/64SnsFpyxGGCrmYHiGxvXSpxxE/S 7o6kJ7pdQ1GDA== Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Date: Wed, 02 Jul 2025 17:04:34 +0200 To: Larry Garfield Cc: php internals Subject: Re: [PHP-DEV] [RFC] Partial Function Application v2 In-Reply-To: References: Message-ID: <0be8afcb6da0e8df4a9f1b446fb35bde@bastelstu.be> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit From: tim@bastelstu.be (=?UTF-8?Q?Tim_D=C3=BCsterhus?=) Hi Am 2025-06-28 07:06, schrieb Larry Garfield: > Hi folks. Arnaud and I would like to present take-2 at Partial > Function Application. > > https://wiki.php.net/rfc/partial_function_application_v2 I've now had a *quick* look at the implementation and the following questions came up that the RFC does not answer (and the tests in the PR do not obviously answer either): How will PFA calls appear in a stack trace and how will PFA Closures look like to `var_dump()`, Reflection, and to observers? Classic FCC are 100% identical to the underlying function and thus can just “pretend” they are the underlying function, but that doesn't work for PFA. Consider the following: function foo(string $s, int $i) { var_dump($s, $i); } $f = foo("abc", ?); $f([]); How will the error message for the resulting TypeError look like? var_dump($f); // same $f How will the output look like? var_dump((new ReflectionFunction($f))->getName()); var_dump((new ReflectionFunction($f))->getParameters()); Ditto is_callable($f, callable_name: $name); var_dump($name); Ditto function foo(string $s, #[\SensitiveParameter] int $i) { throw new \Exception(); } $f = foo("abc", ?); $f(123); How will the stack trace look like? Does `#[\SensitiveParameter]` work properly? Best regards Tim Düsterhus