php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32507 continued: abstract static functions cause error on invocation
Submitted: 2005-03-30 17:51 UTC Modified: 2005-03-30 23:48 UTC
From: soletan at toxa dot de Assigned:
Status: Not a bug Package: Class/Object related
PHP Version: 5.0.3 OS: Linux
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: soletan at toxa dot de
New email:
PHP Version: OS:

 

 [2005-03-30 17:51 UTC] soletan at toxa dot de
Description:
------------
This report is a sequel to BUG #31943 and is in relation to BUG #32506 (posted by myself) most probably.

BUG #31943 was "solved" by reporter without a more detailed note, but nevertheless I think there's a misinterpretation of how and why abstract and static might be combined in an OOP-like system.

Or it is caused by non-virtual resolution of scope-reference self::... - then it is identical to BUG #32506.

Is it bad OOP to have constellations like this code below? Or is it just because of PHP5 not supporting virtual references? Well, in that case I prefer to have it on the wish list.


Best Regards,
Thomas Urban

Reproduce code:
---------------
abstract class a {
  static function test() {
    echo self::read();
  }
  abstract protected static function read();
}

class b extends a {
  protected static function read() {
    return "hello world!";
  }
}

b::test();


Expected result:
----------------
hello world!

Actual result:
--------------
Fatal error: Cannot call abstract method base::read() in ...

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-03-30 18:03 UTC] tony2001@php.net
This is just another reincarnation of bug #30934.
 [2005-03-30 23:48 UTC] sniper@php.net
Please don't submit more bug reports about already reported issues.

 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 17 10:01:30 2025 UTC