Bug #77629 [Opn->Fbk]: Unexpected output of get_class_methods and ReflectionClass::getMethods
| From: | requinix@php.net | Date: | Sun, 17 Feb 2019 13:20:34 +0000 |
| Subject: | Bug #77629 [Opn->Fbk]: Unexpected output of get_class_methods and ReflectionClass::getMethods | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-219616@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=77629&edit=1
ID: 77629
Updated by: requinix@php.net
Reported by: php dot florianberberich at outlook dot com
Summary: Unexpected output of get_class_methods and
ReflectionClass::getMethods
-Status: Open
+Status: Feedback
Type: Bug
Package: Reflection related
Operating System: irrelevant
PHP Version: 7.3.2
Block user comment: N
Private report: N
New Comment:
I don't understand what bug you're reporting. Is the method list missing something? Or
including a method it shouldn't? Because I don't know of anything anywhere that promises
them in a particular order.
Previous Comments:
------------------------------------------------------------------------
[2019-02-17 13:12:21] php dot florianberberich at outlook dot com
Description:
------------
I played around with get_class_methods and Reflection::getMethods and found an imo strange
behaviour.
The sequence of the methods found is the following:
- methods implemented (or declared if still abstract) in the class
- methods implemented (...) in the parent class
- methods implemented (...) in the parent's parent class
- methods implemented (...) in the parent's parent class used traits
- methods implemented (...) in the parent class used traits
- methods implemented (...) in the class used traits
- methods declared (but not yet implemented) in the parent's parent class implemented
interfaces
- methods declared (but not yet implemented) in the parent class implemented interfaces
- methods declared (but not yet implemented) in the class implemented interfaces
What I expected was:
- methods implemented in the class
- methods implemented in the class used traits
- methods implemented in the parent class
- methods implemented in the parent class used traits
- methods implemented in the parent's parent class
- methods implemented in the parent's parent class used traits
- methods declared (but not yet implemented) in the class
- methods declared (...) in the class implemented interfaces
- methods declared (...) in the parent class
- methods declared (...) in the parent class implemented interfaces
- ...
Test script:
---------------
https://3v4l.org/OTqtL
Expected result:
----------------
initMethodInitTest
initMethodInit1
initMethodChangeBehaviourOfInitTest
initMethodInit2
initMethodInitTest
initMethodInit1
Actual result:
--------------
initMethodInitTest
initMethodInit1
initMethodChangeBehaviourOfInitTest
initMethodInitTest
initMethodInit1
initMethodInit2
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=77629&edit=1