php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45571 ReflectionClass::export() shows superclasses' private static methods.
Submitted: 2008-07-20 15:59 UTC Modified: 2008-07-20 16:52 UTC
From: robin_fernandes at uk dot ibm dot com Assigned:
Status: Closed Package: Reflection related
PHP Version: 5.3CVS-2008-07-20 (snap) OS: Windows
Private report: No CVE-ID: None
 [2008-07-20 15:59 UTC] robin_fernandes at uk dot ibm dot com
Description:
------------
A change was made in 5.3 so that ReflectionClass::export() does not list private methods from superclasses (see http://bugs.php.net/37964). However, the change was not applied for static methods.

Proposed patch to restore consistency: http://pastebin.ca/1077574 .


Reproduce code:
---------------
<?php
Class A { 
	private function f() {}
	private static function sf() {}
}

Class C extends A { }

ReflectionClass::export("C");
?>

Expected result:
----------------
Class [ <user> class C extends A ] {
  @@ %s 7-7

  - Constants [0] {
  }

  - Static properties [0] {
  }

  - Static methods [0] {
  }

  - Properties [0] {
  }

  - Methods [0] {
  }
}

Actual result:
--------------
Class [ <user> class C extends A ] {
  @@ %s 7-7

  - Constants [0] {
  }

  - Static properties [0] {
  }

  - Static methods [1] {
    Method [ <user, inherits A> static private method sf ] {
      @@ %s 4 - 4
    }
  }

  - Properties [0] {
  }

  - Methods [0] {
  }
}

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-07-20 16:52 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.

Hi Robin, thanks for the patch. ;)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 06:01:30 2024 UTC