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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Sat Jun 29 10:01:29 2024 UTC