php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45139 ReflectionProperty returns incorrect declaring class
Submitted: 2008-05-31 01:32 UTC Modified: 2008-06-01 03:09 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: david at grudl dot com Assigned: felipe (profile)
Status: Closed Package: Reflection related
PHP Version: 5.2.6 OS: Windows
Private report: No CVE-ID: None
 [2008-05-31 01:32 UTC] david at grudl dot com
Description:
------------
ReflectionProperty returns incorrect declaring class in PHP > 5.1.6

Reproduce code:
---------------
<?php

class A
{
  private $foo;
}


class B extends A
{

}


class C extends B
{
  public $foo;

}




$rc = new ReflectionClass('C');
$rp = $rc->getProperty('foo');
echo $rp->getDeclaringClass()->getName();


Expected result:
----------------
C

Actual result:
--------------
B

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-06-01 03:09 UTC] felipe@php.net
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.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 11:01:28 2024 UTC