1
0
mirror of https://github.com/php/php-src.git synced 2026-04-09 00:53:30 +02:00

Merge branch 'PHP-8.2'

This commit is contained in:
Bob Weinand
2023-02-13 16:34:36 +00:00
3 changed files with 28 additions and 2 deletions

View File

@@ -1,5 +1,5 @@
--TEST--
Bug GH-10496 (Segfault when garbage collector is invoked inside of fiber)
Bug GH-10496 001 (Segfault when garbage collector is invoked inside of fiber)
--FILE--
<?php

View File

@@ -0,0 +1,26 @@
--TEST--
Bug GH-10496 002 (Segfault when garbage collector is invoked inside of fiber)
--FILE--
<?php
function pollute_stack_and_suspend($a = 1, $b = 2, $c = 3) {
Fiber::suspend();
}
$f = new Fiber(function() use (&$f) {
pollute_stack_and_suspend();
(function() {
(function() {
(new Fiber(function() {
gc_collect_cycles();
echo "Success\n";
}))->start();
})();
})();
});
$f->start();
$f->resume();
?>
--EXPECT--
Success

View File

@@ -743,7 +743,7 @@ static HashTable *zend_fiber_object_gc(zend_object *object, zval **table, int *n
zend_get_gc_buffer_add_zval(buf, &fiber->fci.function_name);
zend_get_gc_buffer_add_zval(buf, &fiber->result);
if (fiber->context.status != ZEND_FIBER_STATUS_SUSPENDED) {
if (fiber->context.status != ZEND_FIBER_STATUS_SUSPENDED || fiber->caller != NULL) {
zend_get_gc_buffer_use(buf, table, num);
return NULL;
}