|  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
 [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-2024 The PHP Group
All rights reserved.
Last updated: Tue Jul 16 00:01:27 2024 UTC