ID:              39104
 User updated by: dave at dgx dot cz
 Reported By:     dave at dgx dot cz
-Status:          Bogus
+Status:          Open
 Bug Type:        SPL related
 PHP Version:     5.2.0RC5
 New Comment:

.


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

[2006-10-10 10:51:14] dave at dgx dot cz

Expected??

1)

ReflectionProperty::getDeclaringClass()->getName() -> Foo
ReflectionMethod::getDeclaringClass()->getName() -> Extended

Both property and method are declared in Foo and redeclared in
Extended.

2) How can I detect that private method is declared in reflected class,
and not in any parent class?

------------------------------------------------------------------------

[2006-10-10 10:44:47] [EMAIL PROTECTED]

Expected behaviour.

------------------------------------------------------------------------

[2006-10-10 09:52:22] dave at dgx dot cz

The behaviour is still the same.

------------------------------------------------------------------------

[2006-10-10 08:53:46] [EMAIL PROTECTED]

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



------------------------------------------------------------------------

[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