Merge branch 'PHP-8.2'

* PHP-8.2:
  [ci skip] NEWS
  Fix GH-10437: Set active fiber to null on bailout (#10443)
This commit is contained in:
Aaron Piotrowski 2023-01-28 10:18:51 -06:00
commit ff84598055
No known key found for this signature in database
GPG Key ID: 5B456E6AABA44A63
2 changed files with 19 additions and 0 deletions

View File

@ -0,0 +1,18 @@
--TEST--
GH-10437 (Segfault/assertion when using fibers in shutdown function after bailout)
--FILE--
<?php
register_shutdown_function(function (): void {
var_dump(Fiber::getCurrent());
});
$fiber = new Fiber(function (): never {
trigger_error('Bailout in fiber', E_USER_ERROR);
});
$fiber->start();
?>
--EXPECTF--
Fatal error: Bailout in fiber in %sgh10437.php on line %d
NULL

View File

@ -645,6 +645,7 @@ static zend_always_inline zend_fiber_transfer zend_fiber_switch_to(
/* Forward bailout into current fiber. */
if (UNEXPECTED(transfer.flags & ZEND_FIBER_TRANSFER_FLAG_BAILOUT)) {
EG(active_fiber) = NULL;
zend_bailout();
}