|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74939 Nested traits' aliased methods are lowercased
Submitted: 2017-07-17 11:45 UTC Modified: 2020-03-03 10:57 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: jakub at chabek dot cz Assigned: nikic (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: Irrelevant OS: Irrelevant
Private report: No CVE-ID: None
 [2017-07-17 11:45 UTC] jakub at chabek dot cz
Reflection API returns lower case method name when multiple traits are nested.

Test script:
trait TraitA {
        function sameName() {}

trait TraitB {
        use TraitA {sameName as someOtherName;}   
        function sameName() {}   

class SomeClass {
        use TraitB {sameName as yetAnotherName;}   

        function sameName() {}   

$reflection = new \ReflectionClass(SomeClass::class);

Expected result:
string(13) "someOtherName"

Actual result:
string(13) "someothername"


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2017-07-17 15:06 UTC]
-Summary: ReflectionMethod:getName returns incorrect case when nesting traits +Summary: Nested traits' methods are lowercased -Package: Reflection related +Package: Scripting Engine problem -Operating System: linux, probably irrelevant +Operating System: Irrelevant
 [2017-07-17 15:06 UTC]
The lowercasing is happening in the engine - reflection is working correctly.

Showing all methods:
T1's method is lowercased while T2's is not.
 [2017-07-17 15:06 UTC]
-Summary: Nested traits' methods are lowercased +Summary: Nested traits' aliased methods are lowercased
 [2020-03-02 20:01 UTC]
-Assigned To: +Assigned To: nikic
 [2020-03-03 10:57 UTC]
-Status: Assigned +Status: Closed
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 13 13:01:30 2024 UTC