View Issue Details

IDProjectCategoryView StatusLast Update
0002349XdebugStep Debuggingpublic2025-05-23 08:40
Reporterlcarilla Assigned Toderick  
PrioritynormalSeverityminorReproducibilityhave not tried
Status feedbackResolutionopen 
Summary0002349: https://github.com/xdebug/xdebug/commit/3bb2937e94dfcea6359e9f745e534e2049b2d45d breaks throwing exceptions in nested generators
Description

For the code in the "Steps To Reproduce" section, php with xdebug segfaults.
I did some debugging, it turns out to be this commit.
Interesting side note: i could not reproduce the "demo" leading to the heap corruption error that led to this fix commit being made :)

Steps To Reproduce
<?php
 function repro(
    ) {
        $b = 1;
        foreach (layer1() as $a) {
        }
    }

     function layer1(
    ): Generator {
        yield 1;
        yield from layer2();
    }

     function layer2(
    ): Generator
    {
        throw new \Exception("some random exception");
        yield 1;
    }
repro();
TagsNo tags attached.
Operating SystemLinux
PHP Version8.4-dev

Activities

derick

2025-05-20 18:18

administrator   ~0007288

How do you run this to make it segfault?

When running this on the command line in the following ways, I can't reproduce this:

XDEBUG_MODE=develop valgrind php /tmp/2349/bug02349.inc 

And valgrind shows no warnings either.

juancasanova

2025-05-23 08:35

reporter   ~0007293

I'm pretty sure I've got the same error as lcarilla. I haven't been able to reduce it to an actually small example, but when there is an exception reading messages from RabbitMQ with Xdebug active, it gives a segfault (Symfony uses generators for this, that's why I believe we are talking about the same error).

I have prepared a minimal Symfony project to reproduce the issue: https://github.com/juanmcasanova/xdebug-2349

If you need anything else from me (or that I create a new issue), just let me know!

juancasanova

2025-05-23 08:40

reporter   ~0007294

Sorry, forgot to include my PHP version information:

PHP 8.3.21 (cli) (built: May 21 2025 23:17:35) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.21, Copyright (c) Zend Technologies
with Zend OPcache v8.3.21, Copyright (c), by Zend Technologies
with Xdebug v3.4.3, Copyright (c) 2002-2025, by Derick Rethans

Issue History

Date Modified Username Field Change
2025-05-19 20:01 lcarilla New Issue
2025-05-20 18:10 derick Steps to Reproduce Updated
2025-05-20 18:18 derick Assigned To => derick
2025-05-20 18:18 derick Status new => feedback
2025-05-20 18:18 derick Note Added: 0007288
2025-05-23 08:35 juancasanova Note Added: 0007293
2025-05-23 08:40 juancasanova Note Added: 0007294