PHP :: Bug #36434 :: ReflectionProperty getDeclaringClass
| Bug #36434 | ReflectionProperty getDeclaringClass | ||||
|---|---|---|---|---|---|
| Submitted: | 2006-02-17 23:01 UTC | Modified: | 2006-02-20 16:28 UTC | ||
| From: | gmarzin at club-internet dot fr | Assigned: | |||
| Status: | Closed | Package: | Scripting Engine problem | ||
| PHP Version: | 5CVS-2006-02-17 (snap) | OS: | win32 | ||
| Private report: | No | CVE-ID: | None | ||
[2006-02-17 23:01 UTC] 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
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2006-02-20 16:28 UTC] iliaa@php.net