Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127327 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 1743E1A00BC for ; Fri, 9 May 2025 07:32:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1746775807; bh=Uwmi0D0ok99wnzWigp9qRdsJHaU8TWprLvCKWY2763E=; h=Date:From:To:Subject:From; b=Rq5VlnffXkn6SzTiyDZOLvJ3b5Wra5cD1fGBW8oFLQDaWt0oyfWwinLTqUlhBNb/s gn+poTWbf+7ZDNXndxglQNH5VYV1I0n4yqNA7uNEQlpDCSQhi7LA76HiPVR3l8Iewo h00t3ycH5zs4d7pIRqFFSUOz66w68VhwnK2ofI3rMCRY+FC1mSPY6BOfgEJZo74t53 uxj7Ew8u7AMnKHBoROaNu1kDAcOhsTR40RJXW3qBqizIUX/2LRc3KuD6MUOAsZTX7G xFhP+MWZ8m+Uk0bNCcUio/3p1prXoi89X/uCQiogE0EBJ0kywVMZ5Fubi94nP8npzT c3ra9M64nqBIg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id D69501801C7 for ; Fri, 9 May 2025 07:30:06 +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=-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.0 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 ; Fri, 9 May 2025 07:30:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1746775937; bh=ksdmJzRZNJ0am7Fqux3+EDBrSOYvw0TEyBToB0m2+uA=; h=MIME-Version:Date:From:To:Subject:Message-ID:Content-Type:from:to: cc:subject:message-id; b=HJL6L8Ku0n1kCZ3tB9i5HxvBqDD6gx4piD+ZOBUEm2YYvsxKGtk8vCRTrFIllHH0A cOvx20uXq5CNacfafhHKpVFcOiMwF4ROwEi+iNmjRtT+/ixN9jVgSARewsQC0gE5aR SYsvAyVVN8omJIIKE/2WFak9dXOWJECgmA+ryDpmWMn0zIqfcEywqkbmRkdW3wW0fm veRuT7ldzV5cuTGhduELm/3t/NvLKKJCKd81J7LMTDVqZVwEaazCMof9ygNVKvtfpU x6WgTlqD4c+F2yxlp8ErctRIhxXo+5WlL3JU4eDj6X6hDZZfqfoDlqRO64++zwpVhC A83TrfnYhPuSA== Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Date: Fri, 09 May 2025 09:32:17 +0200 To: internals@lists.php.net Subject: [PHP-DEV] Disallow dynamic calls to assert()? Message-ID: <7d47ba135b9ff6f88caa23cc5638dc5d@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 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: https://github.com/php/php-src/pull/18521 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. 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 Best regards Tim Düsterhus