php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77629 Unexpected output of get_class_methods and ReflectionClass::getMethods
Submitted: 2019-02-17 13:12 UTC Modified: 2019-03-03 04:22 UTC
From: php dot florianberberich at outlook dot com Assigned:
Status: No Feedback Package: Reflection related
PHP Version: 7.3.2 OS: irrelevant
Private report: No CVE-ID: None
 [2019-02-17 13:12 UTC] 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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-02-17 13:20 UTC] requinix@php.net
-Status: Open +Status: Feedback
 [2019-02-17 13:20 UTC] requinix@php.net
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.
 [2019-03-03 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Dec 04 02:01:30 2024 UTC