#36434 [Opn->Csd]: ReflectionProperty getDeclaringClass
| From: | iliaa@php.net | Date: | Mon, 20 Feb 2006 15:28:21 +0000 |
| Subject: | #36434 [Opn->Csd]: ReflectionProperty getDeclaringClass | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-93442@lists.php.net to get a copy of this message | ||
ID: 36434
Updated by: iliaa@php.net
Reported By: gmarzin at club-internet dot fr
-Status: Open
+Status: Closed
Bug Type: Scripting Engine problem
Operating System: win32
-PHP Version: 4CVS-2006-02-17 (snap)
+PHP Version: 5CVS-2006-02-17 (snap)
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2006-02-17 23:01:40] gmarzin at club-internet dot fr
Description:
------------
Before 5.1.3, ReflectionProperty->getDeclaringClass was working ok.
Exactly like ReflectionMethod->getDeclaringClass: the reflectionClass
could be an ancester.
Actually, with 5.1.3 ReflectionMethod work OK, but ReflectionProperty
do not give back the ancesters classes.
Reproduce code:
---------------
<?php
class ancester
{
public $ancester = 0;
function ancester()
{
return $this->ancester;
}
}
class foo extends ancester
{
public $bar = "1";
function foo()
{
return $this->bar;
}
}
$r = new ReflectionClass('foo');
$prop = $r->GetProperties();
foreach ($prop as $p)
{
$owner = $p->getDeclaringClass();
echo $p->getName(). " <b>".
$owner->getName()."</b><br/>";
}
$methode = $r->GetMethods();
foreach ($methode as $m)
{
$owner = $m->getDeclaringClass();
echo $m->getName(). " <b>".
$owner->getName()."</b><br/>";
}
?>
Expected result:
----------------
bar foo
ancester ancester
foo foo
ancester ancester
Actual result:
--------------
bar foo
ancester foo (expecting "ancester")
foo foo
ancester ancester
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=36434&edit=1