View Issue Details

IDProjectCategoryView StatusLast Update
0001998XdebugStep Debuggingpublic2021-10-04 09:32
Reporteragustingomes Assigned To 
PrioritylowSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Product Version3.1dev 
Target Version3.1devFixed in Version3.1.0 
Summary0001998: Double facet attribute generated for enums that are stored in properties
Description

The step debugging process seem to end up abruptly when the assignment of an enum is done inside a class. PHPStorm seems to receive an instruction to break the execution of the script, but continues immediately afterwards.

This happens on the current master state of the branch: (https://github.com/xdebug/xdebug/commit/b1a26aef7b94374d44e0cfda6b283d8955a916a5)

Steps To Reproduce

consider the following script:

<?php
enum Currency: string {
    case EUR = "€";
    case GBP = "£";
}

final class TotalAmount
{
    private int $amount;

    private Currency $currency;

    public function __construct(int $amount, Currency $currency)
    {
        $this->amount = $amount;
        $this->currency = $currency;
    }
}

$totalAmount = new TotalAmount(30, Currency::EUR);

echo "Hi!\n";

Adding a breakpoint in the echo "Hi!\n"; doesn't work, and the program continues it's execution, finishing with exit code 0

Additional Information

From the initial information I managed to collect, it seems the issue is in how the currency property is described. the property node has 2 facets, one with the property visibility, and another specifying it's an enum:

<property name="currency" fullname="$totalAmount->currency" facet="private" type="object" facet="enum" classname="Currency" children="1" numchildren="2"></property>

TagsDoesn't Break
Operating SystemLinux
PHP Version8.1-dev

Activities

derick

2021-07-27 23:36

administrator   ~0005944

Thanks for this. I think that some XML parsers might stumble over this. Xdebug's DBGp Client or test framework does not, but I guess PhpStorm does. I'll go try it with PhpStorm (which seems to close the debugging connection), and then proceed with a fix.

derick

2021-07-28 09:49

administrator   ~0005945

https://github.com/xdebug/xdebug/pull/764

derick

2021-07-28 11:04

administrator   ~0005946

I've merged this in GIT now, and from my cursory testing with PhpStorm it now works. It'd be great if you could test it again too please.

agustingomes

2021-07-28 11:37

reporter   ~0005948

Hi Derick.

I recompiled the Docker image with the latest master branch, and I can confirm the fix works. Thank you for looking into this so quickly.