ID:          39104
 Updated by:  [EMAIL PROTECTED]
 Reported By: dave at dgx dot cz
-Status:      Open
+Status:      Feedback
 Bug Type:    SPL related
 PHP Version: 5.2.0RC5
 New Comment:

Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip




Previous Comments:
------------------------------------------------------------------------

[2006-10-10 05:15:42] dave at dgx dot cz

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 this bug report at http://bugs.php.net/?id=39104&edit=1

Reply via email to