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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: robin_fernandes at uk dot ibm dot com
New email:
PHP Version: OS:

 

 [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

Add a Patch

Pull Requests

Add a Pull Request

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: Fri Apr 19 19:01:28 2024 UTC