Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127332 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 8520F1A00BC for ; Sun, 11 May 2025 13:35:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1746970392; bh=pRnafYAZbytnAYM2omMwFubG2J6KX4N2CoN5svOksR8=; h=Date:To:From:Cc:Subject:In-Reply-To:References:From; b=j7mbg0kdOq9P4oU7pcqaV/0DJ5mzvqyO9mmvGTAlieFOWslgxVRdTgp4ChjwBXigD Maxnta0/+6Pwb0zHCd2Sb60EFwvfO5XYubdJPvPkZ0PPNv+XmKWFQskRn3VQNH0/Xn HA+6yPMvYsP6lLRQG+Z/a91+KnnPaFwDg5O1m7zZtNloTsyUXjxe8j9CcvM3W9yPzI uMqnU4dSGenyAfbMG4DjA75wBYfcnq4a0U5QJ6rKPvUm9MIQIu3Xf7J+6shAhDSqbr W9Qhz/OloQLVNeuYFKk9wvAZ+Sb9fSeGd5fGs2W00PQEH3yZG7rcnAh9UhgGVm8dZF MNAY0xpAKHh7A== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id F133818006C for ; Sun, 11 May 2025 13:33:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,SPF_HELO_PASS, SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from mail-24421.protonmail.ch (mail-24421.protonmail.ch [109.224.244.21]) (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 ; Sun, 11 May 2025 13:32:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gpb.moe; s=protonmail3; t=1746970509; x=1747229709; bh=pRnafYAZbytnAYM2omMwFubG2J6KX4N2CoN5svOksR8=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector:List-Unsubscribe:List-Unsubscribe-Post; b=p24C5kV4g/whe3l6Yffu+qAgPwE+zNEU595E+SUt65VdcgQw+4SB0DupblaSJvojo pD7TgYq05VeyqEOlMc5SzNKyLLsqeG+h1ntLbAUxnP8wm4XnAdw81WfBD9J5+3X+0R Nuhpw44QqX0200NV6lWEurhXHCvqbwFBRqeXNJPuIQ07YwKkBD2PZnYE+rbxQNbznm KxbUUMBO0kuxBwOdXoWA5G0QPeSpPfp16egy6ff5KZS+4C8HduvlqamfSCDyBvZXT5 sFexifr7JhMmh2PURMJisMi8AAh2SXEBRVw/qUCJBvkySEozLlodSecT2xV406bJrH MxgvlEeKDYVXg== Date: Sun, 11 May 2025 13:35:03 +0000 To: =?utf-8?Q?Tim_D=C3=BCsterhus?= Cc: internals@lists.php.net Subject: Re: [PHP-DEV] Disallow dynamic calls to assert()? Message-ID: In-Reply-To: <7d47ba135b9ff6f88caa23cc5638dc5d@bastelstu.be> References: <7d47ba135b9ff6f88caa23cc5638dc5d@bastelstu.be> Feedback-ID: 96993444:user:proton X-Pm-Message-ID: c0b694786ff0898e221c5d5fe3109f9e6adaad90 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: internals@gpb.moe ("Gina P. Banyard") On Friday, 9 May 2025 at 08:35, Tim D=C3=BCsterhus wrote= : > Hi >=20 > I noticed that dynamic calls to the `assert()` function do not take the > `zend.assertions` into account, since for static calls `zend.assertions` > is checked inside the compiler to completely bypass the call to > `assert()` including the evaluation of all arguments. I created a PR to > fix that, making dynamic calls to assert always return true just like > static calls: >=20 > https://github.com/php/php-src/pull/18521 >=20 > However these dynamic calls still evaluate their arguments, which makes > for a behavioral difference that might be confusing. Niels rightfully > pointed out that it is possible to forbid dynamic calls to a given > function, this is already used for things like `compact()` or > `func_get_args()`. Disallowing dynamic calls to `assert()` would > completely bypass this problem. >=20 > Does anyone have an opinion either way? Please comment on the GitHub > issue if you do so: > https://github.com/php/php-src/pull/18521#pullrequestreview-2825782965 >=20 > Best regards > Tim D=C3=BCsterhus This makes sense to me, I don't really see why one would ever need to call = assert dynamically. Is it possible to prevent retrieving a closure by using the FCC syntax at c= ompile time? Best regards, Gina P. Banyard