From:             dave at dgx dot cz
Operating system: 
PHP version:      5.2.0RC5
PHP Bug Type:     SPL related
Bug description:  ReflectionClass::getMethod and private method

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();



-- 
Edit bug report at http://bugs.php.net/?id=39104&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=39104&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=39104&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=39104&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=39104&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=39104&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=39104&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=39104&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=39104&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=39104&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=39104&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=39104&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=39104&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=39104&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=39104&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=39104&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=39104&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=39104&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=39104&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=39104&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=39104&r=mysqlcfg

Reply via email to