Skip to content

Assertion failure in check_node_running_in_fiber with generator in destructor #20893

@vi3tL0u1s

Description

@vi3tL0u1s

Description

The following code:

<?php
class a {
    static $b;
    static $max = 2.;
    function __destruct() {
        if (self::$max-- < 0) return;
        self::$b = $this;
        static $gen = (function() {
            $from = (function () {
                x:$n[] = new a;
                yield;        
            })();
            try { yield from $from; } finally {}
        })();
        $fiber = new Fiber(function () use ($gen) {
            $gen->current();
            $gen->next();
        });
        $fiber->start();
    }
}
new a;
php: /path/to/php-src/Zend/zend_generators.c:217: check_node_running_in_fiber: Assertion `generator->execute_data' failed.
Aborted

Commit

c518a6ba8bf7a3eb6551424c7ca90dfa06b01b15

Configurations

./configure --enable-debug --enable-address-sanitizer --disable-shared --with-pic --enable-mbstring --with-zlib

PHP Version

PHP 8.6.0-dev (cli) (built: Jan  9 2026 14:43:36) (NTS DEBUG)
Copyright (c) The PHP Group
Zend Engine v4.6.0-dev, Copyright (c) Zend Technologies
    with Zend OPcache v8.6.0-dev, Copyright (c), by Zend Technologies

Operating System

Ubuntu 22.04

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions