From: alasdair at softhome dot net Operating system: Debian Wheezy PHP version: 5.4.15 Package: Reflection related Bug Type: Bug Bug description:ReflectionClass::getMethods does not identify traits
Description: ------------ Specific PHP version PHP 5.4.15-1~dotdeb.2 Executing ReflectionClass::getMethods on a class using traits does not differentiate between methods within the class or methods within the trait being used, whereas calling ReflectionMethod::getDeclaringClass on the class with the method identifies it as coming from the trait. Test script: --------------- <?php trait t { function f() { //do stuff } } Class c { use t; function f2() { //do stuff } } $class = new ReflectionClass('c'); print_r($class->getMethods()); ?> Expected result: ---------------- Array ( [0] => ReflectionMethod Object ( [name] => f2 [class] => c ) [1] => ReflectionMethod Object ( [name] => f [class] => t ) ) or Array ( [0] => ReflectionMethod Object ( [name] => f2 [class] => c ) [1] => ReflectionMethod Object ( [name] => f [trait] => t ) ) Actual result: -------------- Array ( [0] => ReflectionMethod Object ( [name] => f2 [class] => c ) [1] => ReflectionMethod Object ( [name] => f [class] => c ) ) -- Edit bug report at https://bugs.php.net/bug.php?id=64963&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=64963&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=64963&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=64963&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=64963&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=64963&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=64963&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=64963&r=needscript Try newer version: https://bugs.php.net/fix.php?id=64963&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=64963&r=support Expected behavior: https://bugs.php.net/fix.php?id=64963&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=64963&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=64963&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=64963&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=64963&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=64963&r=dst IIS Stability: https://bugs.php.net/fix.php?id=64963&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=64963&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=64963&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=64963&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=64963&r=mysqlcfg