[php-src] master: Merge branch 'PHP-8.5' into PHP-8.6

From: Date: Sat, 24 Oct 2026 14:17:47 +0000
Subject: [php-src] master: Merge branch 'PHP-8.5' into PHP-8.6
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-142676@lists.php.net to get a copy of this message
Author: David Carlier (devnexen) Date: 2026-10-24T15:11:19+01:00 Commit: https://github.com/php/php-src/commit/1bc3dc51a2080a6119d2b3a8521146239c33ba08 Raw diff: https://github.com/php/php-src/commit/1bc3dc51a2080a6119d2b3a8521146239c33ba08.diff Merge branch 'PHP-8.5' into PHP-8.6 * PHP-8.5: Fix GH-24265: zend_fiber_execute() discards exit() in a destroyed fiber Changed paths: A Zend/tests/fibers/gh24265-001.phpt A Zend/tests/fibers/gh24265-002.phpt M Zend/zend_fibers.c Diff: diff --git a/Zend/tests/fibers/gh24265-001.phpt b/Zend/tests/fibers/gh24265-001.phpt new file mode 100644 index 000000000000..d4eed32fc624 --- /dev/null +++ b/Zend/tests/fibers/gh24265-001.phpt @@ -0,0 +1,24 @@ +--TEST-- +GH-24265 (exit() in a finally block of a destroyed fiber is discarded) +--CREDITS-- +iluuu1994 +--FILE-- +<?php + +$fiber = new Fiber(function () { + try { + Fiber::suspend(); + } finally { + exit(1); + } +}); + +$fiber->start(); +echo "Before destroy", PHP_EOL; +unset($fiber); + +echo "Not reached", PHP_EOL; + +?> +--EXPECT-- +Before destroy diff --git a/Zend/tests/fibers/gh24265-002.phpt b/Zend/tests/fibers/gh24265-002.phpt new file mode 100644 index 000000000000..2a794bc3d02f --- /dev/null +++ b/Zend/tests/fibers/gh24265-002.phpt @@ -0,0 +1,30 @@ +--TEST-- +GH-24265 (exit() in a destroyed fiber is discarded while an exception is pending) +--FILE-- +<?php + +function test() { + $fiber = new Fiber(function () { + try { + Fiber::suspend(); + } finally { + exit(1); + } + }); + + $fiber->start(); + echo "Before destroy", PHP_EOL; + throw new Exception("pending"); +} + +try { + test(); +} catch (Exception $e) { + echo $e::class, ': ', $e->getMessage(), PHP_EOL; +} + +echo "Not reached", PHP_EOL; + +?> +--EXPECT-- +Before destroy diff --git a/Zend/zend_fibers.c b/Zend/zend_fibers.c index dc8b3f609c68..63e598a58cc2 100644 --- a/Zend/zend_fibers.c +++ b/Zend/zend_fibers.c @@ -641,9 +641,7 @@ static ZEND_STACK_ALIGNED void zend_fiber_execute(zend_fiber_transfer *transfer) zend_fiber_release_callable(fiber); if (EG(exception)) { - if (!(fiber->flags & ZEND_FIBER_FLAG_DESTROYED) - || !(zend_is_graceful_exit(EG(exception)) || zend_is_unwind_exit(EG(exception))) - ) { + if (!(fiber->flags & ZEND_FIBER_FLAG_DESTROYED) || !zend_is_graceful_exit(EG(exception))) { fiber->flags |= ZEND_FIBER_FLAG_THREW; transfer->flags = ZEND_FIBER_TRANSFER_FLAG_ERROR;

« previous php.cvs (#142676) next »