[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-cvs
Subject:    [PHP-CVS] [php-src] master: Merge branch 'PHP-8.2'
From:       Aaron Piotrowski <noreply () php ! net>
Date:       2023-01-28 16:32:51
Message-ID: lr6sfsHysWvhhgYa8ld1USLrNoapa6BwgYn975tEZJs () main ! php ! net
[Download RAW message or body]

Author: Aaron Piotrowski (trowski)
Date: 2023-01-28T10:18:51-06:00

Commit: https://github.com/php/php-src/commit/ff8459805576a78008fab1ad71ede004071b6ad2
Raw diff: https://github.com/php/php-src/commit/ff8459805576a78008fab1ad71ede004071b6ad2.diff

Merge branch 'PHP-8.2'

* PHP-8.2:
  [ci skip] NEWS
  Fix GH-10437: Set active fiber to null on bailout (#10443)

Changed paths:
  A  Zend/tests/fibers/gh10437.phpt
  M  Zend/zend_fibers.c


Diff:

diff --git a/Zend/tests/fibers/gh10437.phpt b/Zend/tests/fibers/gh10437.phpt
new file mode 100644
index 000000000000..5c793c986ee2
--- /dev/null
+++ b/Zend/tests/fibers/gh10437.phpt
@@ -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
diff --git a/Zend/zend_fibers.c b/Zend/zend_fibers.c
index 50c7ef9635f3..5edefdb8052f 100644
--- a/Zend/zend_fibers.c
+++ b/Zend/zend_fibers.c
@@ -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();
 	}
 

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic