|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69589 calling abstract child static function from parent constructor generates error
Submitted: 2015-05-07 01:59 UTC Modified: 2015-05-07 02:48 UTC
From: guvenc at objexa dot com Assigned: requinix (profile)
Status: Closed Package: Unknown/Other Function
PHP Version: 5.6Git-2015-05-07 (Git) OS: ubuntu
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.
Bug Type:
From: guvenc at objexa dot com
New email:
PHP Version: OS:


 [2015-05-07 01:59 UTC] guvenc at objexa dot com
calling a child classes static function from parent constructor generates error

Test script:
class A{
  public function __construct(){
  abstract protected static function someFunc;


Class B extens A{
  public function __construct(){
  protected static function someFunc(){


$obj = new B();

Expected result:
I expect it to keep executing with no errors.

Actual result:
ErrorException with message 'Static function A::someFunc() should not be abstract'


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2015-05-07 02:48 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: requinix
 [2015-05-07 02:48 UTC]
If you have an ErrorException then it's because you have error handling code that creates and throws exceptions. PHP isn't doing it. The error message is from a mere E_STRICT.

...which has been removed in PHP 7.
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Mon Aug 08 00:05:45 2022 UTC