[php-src] Issue #14495: Issue with the order of used inherited traits since 8.3.8/8.2.20
| From: | lernhart | Date: | Fri, 07 Jun 2024 08:56:46 +0000 |
| Subject: | [php-src] Issue #14495: Issue with the order of used inherited traits since 8.3.8/8.2.20 | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-247057@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/14495
Author: lernhart
### Description
The following code:
https://3v4l.org/lFFsD
Resulted in this output:
```
Fatal error: Uncaught Error: Call to protected method ParentClass::doSomething() from scope
ChildClass in /in/lFFsD:25
Stack trace:
#0 /in/lFFsD(29): ChildClass->__construct()
#1 {main}
thrown in /in/lFFsD on line 25
Process exited with code 255.
```
But I expected this output instead:
```
FOO (result of method of parent trait)
```
The order of the used traits does matter since 8.3.8 and 8.2.20.
As seen in the 3v4l example, the trait
TraitA, which implements the method is used
**after** the TraitB, which declares the abstract method.
The order of the traits does **not** matter, if the child class directly uses the traits.
This [commit](https://github.com/php/php-src/commit/c6b75f93289459b85923b104a071b464e031143f) may
relate to the issue ?
### PHP Version
8.3.8
### Operating System
_No response_