[php-src] Issue #9271: Collision of interface constant and trait constant doesn't produce fatal error
| From: | MaXal | Date: | Mon, 08 Aug 2022 13:25:58 +0000 |
| Subject: | [php-src] Issue #9271: Collision of interface constant and trait constant doesn't produce fatal error | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-242148@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/9271
Author: MaXal
### Description
The following code:
```php
<?php
trait MyTrait{
const A = 1;
}
interface I{
const A = 2;
}
class D implements I{
use MyTrait;
}
echo D::A;
```
Resulted in this output:
```
1
```
But I expected this output instead:
```
Fatal error: I and MyTrait define the same constant (A) in the composition of D. However, the
definition differs and is considered incompatible. Class was composed in /in/EVuKh on line 10
```
### PHP Version
8.2
### Operating System
_No response_