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