mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
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:
commit
ff84598055
2 changed files with 19 additions and 0 deletions
18
Zend/tests/fibers/gh10437.phpt
Normal file
18
Zend/tests/fibers/gh10437.phpt
Normal 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
|
|
@ -645,6 +645,7 @@ static zend_always_inline zend_fiber_transfer zend_fiber_switch_to(
|
||||||
|
|
||||||
/* Forward bailout into current fiber. */
|
/* Forward bailout into current fiber. */
|
||||||
if (UNEXPECTED(transfer.flags & ZEND_FIBER_TRANSFER_FLAG_BAILOUT)) {
|
if (UNEXPECTED(transfer.flags & ZEND_FIBER_TRANSFER_FLAG_BAILOUT)) {
|
||||||
|
EG(active_fiber) = NULL;
|
||||||
zend_bailout();
|
zend_bailout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue