php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37684 read class name of a inherited class with a inherited static method possible?
Submitted: 2006-06-02 20:24 UTC Modified: 2006-06-02 20:36 UTC
Votes:6
Avg. Score:4.7 ± 0.7
Reproduced:5 of 6 (83.3%)
Same Version:3 (60.0%)
Same OS:2 (40.0%)
From: info at marcgrabow dot de Assigned:
Status: Wont fix Package: Class/Object related
PHP Version: 5CVS-2006-06-02 (snap) OS: Win 2000
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: info at marcgrabow dot de
New email:
PHP Version: OS:

 

 [2006-06-02 20:24 UTC] info at marcgrabow dot de
Description:
------------
I want to extract the class name of a inherited class with a inherited static method.

I've tried that in a lot of ways, but I didn't get it.

Is it possible at all?

Reproduce code:
---------------
class TestParent {
  static function getClass() {
    return get_class();
  }
}

class TestChild extends TestParent {
}

echo TestChild::getClass();

Expected result:
----------------
TestChild

Actual result:
--------------
TestParent

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-06-02 20:36 UTC] tony2001@php.net
You have to wait until we implement late static binding.
But personally I think your code works exactly the way it should work.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Feb 16 18:01:29 2025 UTC