mirror of
https://github.com/php/php-src.git
synced 2025-08-16 14:08:47 +02:00
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:
commit
a1295cbfce
2 changed files with 23 additions and 0 deletions
22
Zend/tests/generators/gh9752.phpt
Normal file
22
Zend/tests/generators/gh9752.phpt
Normal 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==
|
|
@ -44,6 +44,7 @@ ZEND_API void zend_generator_restore_call_stack(zend_generator *generator) /* {{
|
||||||
ZEND_CALL_NUM_ARGS(call),
|
ZEND_CALL_NUM_ARGS(call),
|
||||||
Z_PTR(call->This));
|
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));
|
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;
|
new_call->prev_execute_data = prev_call;
|
||||||
prev_call = new_call;
|
prev_call = new_call;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue