Merge branch 'PHP-8.1'

* PHP-8.1:
  Start new block after loop free
This commit is contained in:
Nikita Popov 2021-10-04 17:02:40 +02:00
commit d1aff29a04
2 changed files with 21 additions and 0 deletions

View File

@ -437,6 +437,9 @@ ZEND_API void zend_build_cfg(zend_arena **arena, const zend_op_array *op_array,
case ZEND_FE_FREE:
if (zend_optimizer_is_loop_var_free(opline)) {
BB_START(i);
if (i + 1 < op_array->last) {
BB_START(i + 1);
}
flags |= ZEND_FUNC_FREE_LOOP_VAR;
}
break;

18
Zend/tests/match/045.phpt Normal file
View File

@ -0,0 +1,18 @@
--TEST--
Corrupted CFG due to unreachable free with match
--FILE--
<?php
function test() {
var_dump(match(x){});
match(y){
3, 4 => 5,
};
}
try {
test();
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
Undefined constant "x"