mirror of
https://github.com/php/php-src.git
synced 2024-09-22 10:27:25 +00:00
fdc22744a8
Co-authored-by: Martin Schröder <m.schroeder2007@gmail.com>
36 lines
824 B
PHP
36 lines
824 B
PHP
--TEST--
|
|
Context switches are prevented during GC collect cycles
|
|
--FILE--
|
|
<?php
|
|
|
|
$fiber = new Fiber(function () {
|
|
call_user_func(function () {
|
|
$a = new class () {};
|
|
|
|
$b = new class () {
|
|
public function __destruct() {
|
|
Fiber::suspend();
|
|
}
|
|
};
|
|
|
|
$a->next = $b;
|
|
$b->next = $a;
|
|
});
|
|
|
|
gc_collect_cycles();
|
|
});
|
|
|
|
$fiber->start();
|
|
|
|
?>
|
|
--EXPECTF--
|
|
Fatal error: Uncaught FiberError: Cannot switch fibers in current execution context in %sno-switch-gc.php:%d
|
|
Stack trace:
|
|
#0 %sno-switch-gc.php(%d): Fiber::suspend()
|
|
#1 [internal function]: class@anonymous->__destruct()
|
|
#2 %sno-switch-gc.php(%d): gc_collect_cycles()
|
|
#3 [internal function]: {closure}()
|
|
#4 %sno-switch-gc.php(%d): Fiber->start()
|
|
#5 {main}
|
|
thrown in %sno-switch-gc.php on line %d
|