Merge branch 'PHP-8.1' into PHP-8.2

* PHP-8.1:
  [ci skip] NEWS
  [ci skip] NEWS
  Restore extra_named_params when restoring frozen call stack
This commit is contained in:
Arnaud Le Blanc 2022-10-16 12:45:41 +02:00
commit a1295cbfce
2 changed files with 23 additions and 0 deletions

View file

@ -0,0 +1,22 @@
--TEST--
Bug GH-9752 (Generator crashes when interrupted during a function call with extra named params)
--FILE--
<?php
function f(...$x) {
}
function g() {
f(a: 1, b: yield);
};
$gen = g();
foreach ($gen as $value) {
break;
}
?>
==DONE==
--EXPECT--
==DONE==

View file

@ -44,6 +44,7 @@ ZEND_API void zend_generator_restore_call_stack(zend_generator *generator) /* {{
ZEND_CALL_NUM_ARGS(call),
Z_PTR(call->This));
memcpy(((zval*)new_call) + ZEND_CALL_FRAME_SLOT, ((zval*)call) + ZEND_CALL_FRAME_SLOT, ZEND_CALL_NUM_ARGS(call) * sizeof(zval));
new_call->extra_named_params = call->extra_named_params;
new_call->prev_execute_data = prev_call;
prev_call = new_call;