Skip to content

Dynamic calls to assert() ignore zend.assertions #18509

Closed

Description

@TimWolla

Description

The following code:

<?php

$c = "assert";

$c(false);

Resulted in this output:

Fatal error: Uncaught AssertionError in php-src/test.php:5
Stack trace:
#0 php-src/test.php(5): assert(false)
#1 {main}
  thrown in php-src/test.php on line 5

But I expected this output instead:


In this case it would be unreasonable to expect that the evaluation of the arguments are skipped, but I would at least expect that the assertion itself becomes a noop.

The same applies to:

<?php

array_map(assert(...), [true, true, false]);

PHP Version

git master

Operating System

No response

Activity

  1. changed the title [-]Dynamioc calls to `assert()` ignore `zend.assertions`[/-] [+]Dynamic calls to `assert()` ignore `zend.assertions`[/+] on May 6, 2025
  2. self-assigned this
    on May 8, 2025
  3. added a commit that references this issue on May 12, 2025
    8d2682f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions