[php-src] Issue #21760: Trait with class constant name conflict against enum case causes SEGV

[email protected] (ndossche)
Newsgroups php.bugs
Message-ID <1GCMr7fRF8UaSXQ77KuWBGbyUV7SqttD7T4py9nb7S8@main.internal.php.net>
Issue: https://github.com/php/php-src/issues/21760
Author: ndossche

### Description

The following code:

```php
<?php
trait X {
  public const Up = 1;
}

enum Direction {
  use X;

  case Up;
  case Down;
}
```

Resulted in this output:
```
SEGV
```

But I expected this output instead:
```
Not that
```


### PHP Version

```plain
Reproduced on master but likely affects all versions since enums were added
```

### Operating System

_No response_
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.