mirror of
https://github.com/php/php-src.git
synced 2025-08-15 13:38:49 +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
2
NEWS
2
NEWS
|
@ -37,6 +37,8 @@ PHP NEWS
|
||||||
- Standard:
|
- Standard:
|
||||||
. Fixed bug GH-17403 (Potential deadlock when putenv fails). (nielsdos)
|
. Fixed bug GH-17403 (Potential deadlock when putenv fails). (nielsdos)
|
||||||
. Fixed bug GH-18400 (http_build_query type error is inaccurate). (nielsdos)
|
. Fixed bug GH-18400 (http_build_query type error is inaccurate). (nielsdos)
|
||||||
|
. Fixed bug GH-18509 (Dynamic calls to assert() ignore zend.assertions).
|
||||||
|
(timwolla)
|
||||||
|
|
||||||
- Windows:
|
- Windows:
|
||||||
. Fix leak+crash with sapi_windows_set_ctrl_handler(). (nielsdos)
|
. Fix leak+crash with sapi_windows_set_ctrl_handler(). (nielsdos)
|
||||||
|
|
|
@ -178,7 +178,11 @@ PHP_FUNCTION(assert)
|
||||||
zend_string *description_str = NULL;
|
zend_string *description_str = NULL;
|
||||||
zend_object *description_obj = 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;
|
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