mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3: standard: Take `zend.assertions` into account for dynamic calls to `assert()` (#18521)
This commit is contained in:
commit
40edd58d36
3 changed files with 30 additions and 1 deletions
|
@ -178,7 +178,11 @@ PHP_FUNCTION(assert)
|
|||
zend_string *description_str = NULL;
|
||||
zend_object *description_obj = NULL;
|
||||
|
||||
if (!ASSERTG(active)) {
|
||||
/* EG(assertions) <= 0 is only reachable by dynamic calls to assert(),
|
||||
* since calls known at compile time will skip the entire call when
|
||||
* assertions are disabled.
|
||||
*/
|
||||
if (!ASSERTG(active) || EG(assertions) <= 0) {
|
||||
RETURN_TRUE;
|
||||
}
|
||||
|
||||
|
|
23
ext/standard/tests/assert/gh18509.phpt
Normal file
23
ext/standard/tests/assert/gh18509.phpt
Normal file
|
@ -0,0 +1,23 @@
|
|||
--TEST--
|
||||
GH-18509: Dynamic calls to assert() ignore zend.assertions
|
||||
--INI--
|
||||
zend.assertions=0
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$c = "assert";
|
||||
|
||||
$c(false);
|
||||
|
||||
var_dump(array_map(assert(...), [true, true, false]));
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
array(3) {
|
||||
[0]=>
|
||||
bool(true)
|
||||
[1]=>
|
||||
bool(true)
|
||||
[2]=>
|
||||
bool(true)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue