|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-10-10 08:53 UTC] tony2001@php.net
[2006-10-10 09:52 UTC] dave at dgx dot cz
[2006-10-10 10:44 UTC] tony2001@php.net
[2006-10-10 10:51 UTC] dave at dgx dot cz
[2006-10-13 10:45 UTC] tony2001@php.net
[2006-10-13 11:28 UTC] dave at dgx dot cz
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 03 01:00:01 2025 UTC |
Description: ------------ I'd to like to see 5.2 as first version of PHP, where Reflection works correctly ;-)) 1) ReflectionProperty::getDeclaringClass works good, ReflectionMethod::getDeclaringClass doesn't. class Foo { // ReflectionProperty test public $prop; protected function a() {} protected static function b() {} public function c() {} public static function d() {} } class Extended extends Foo { // redeclare all members public $prop; protected function a() {} protected static function b() {} public function c() {} public static function d() {} } $rc = new ReflectionClass('Extended'); // prints Foo - OK! echo $rc->getProperty('prop')->getDeclaringClass()->getName(); // prints Extended - ERROR echo $rc->getMethod('a')->getDeclaringClass()->getName(); echo $rc->getMethod('b')->getDeclaringClass()->getName(); echo $rc->getMethod('c')->getDeclaringClass()->getName(); echo $rc->getMethod('d')->getDeclaringClass()->getName(); 2) there still remains bug #37964: Reflection shows private methods of parent class. Private AND/OR private static class Foo { private function a() {} private static function b() {} } class Extended extends Foo { // there is no method a() or b() in class Extended } Extended::b(); // this produces fatal error, OK $rc = new ReflectionClass('Extended'); $rc->hasMethod('a'); // but this returns TRUE - ERROR // and this works too, but shouldn't echo $rc->getMethod('a')->getName(); echo $rc->getMethod('b')->getName();