Skip to content

Commit 12b9b76

Browse files
committed
Interrupt while internal frame is on the stack
1 parent 5d359cd commit 12b9b76

File tree

3 files changed

+49
-8
lines changed

3 files changed

+49
-8
lines changed

Zend/tests/fibers/signal-async.phpt

+5-4
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@ Fiber start
3030
Fatal error: Uncaught FiberError: Cannot switch fibers in current execution context in %ssignal-async.php:%d
3131
Stack trace:
3232
#0 %ssignal-async.php(%d): Fiber::suspend()
33-
#1 %ssignal-async.php(%d): {closure:%s:%d}(%d, Array)
34-
#2 [internal function]: {closure:%s:%d}()
35-
#3 %ssignal-async.php(%d): Fiber->start()
36-
#4 {main}
33+
#1 [internal function]: {closure:%s:%d}(%d, Array)
34+
#2 %ssignal-async.php(%d): posix_kill(%d, %d)
35+
#3 [internal function]: {closure:%s:%d}()
36+
#4 %ssignal-async.php(%d): Fiber->start()
37+
#5 {main}
3738
thrown in %ssignal-async.php on line %d

Zend/zend_vm_def.h

+11-1
Original file line numberDiff line numberDiff line change
@@ -4015,6 +4015,14 @@ ZEND_VM_HOT_HANDLER(129, ZEND_DO_ICALL, ANY, ANY, SPEC(RETVAL,OBSERVER))
40154015
#endif
40164016
ZEND_OBSERVER_FCALL_END(call, EG(exception) ? NULL : ret);
40174017

4018+
if (UNEXPECTED(zend_atomic_bool_load_ex(&EG(vm_interrupt)))) {
4019+
if (zend_atomic_bool_load_ex(&EG(timed_out))) {
4020+
zend_timeout();
4021+
} else if (zend_interrupt_function) {
4022+
zend_interrupt_function(execute_data);
4023+
}
4024+
}
4025+
40184026
EG(current_execute_data) = execute_data;
40194027
zend_vm_stack_free_args(call);
40204028

@@ -4037,7 +4045,9 @@ ZEND_VM_HOT_HANDLER(129, ZEND_DO_ICALL, ANY, ANY, SPEC(RETVAL,OBSERVER))
40374045
HANDLE_EXCEPTION();
40384046
}
40394047

4040-
ZEND_VM_SET_OPCODE(opline + 1);
4048+
CHECK_SYMBOL_TABLES()
4049+
OPLINE = opline + 1;
4050+
40414051
ZEND_VM_CONTINUE();
40424052
}
40434053

Zend/zend_vm_execute.h

+33-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)