|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-02-20 16:28 UTC] iliaa@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 21:00:01 2025 UTC |
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