Skip to content

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

@TimWolla

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

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions