no-switch-dtor-start.phpt 517 B

1234567891011121314151617181920
  1. --TEST--
  2. Cannot start fiber within destructor
  3. --FILE--
  4. <?php
  5. return new class () {
  6. public function __destruct() {
  7. $fiber = new Fiber(fn () => null);
  8. $fiber->start();
  9. }
  10. };
  11. ?>
  12. --EXPECTF--
  13. Fatal error: Uncaught FiberError: Cannot switch fibers in current execution context in %sno-switch-dtor-start.php:%d
  14. Stack trace:
  15. #0 %sno-switch-dtor-start.php(%d): Fiber->start()
  16. #1 %sno-switch-dtor-start.php(%d): class@anonymous->__destruct()
  17. #2 {main}
  18. thrown in %sno-switch-dtor-start.php on line %d