Bug #69589 [Opn->Csd]: calling abstract child static function from parent constructor generates error

From: Date: Thu, 07 May 2015 02:48:32 +0000
Subject: Bug #69589 [Opn->Csd]: calling abstract child static function from parent constructor generates error
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-192543@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=69589&edit=1

 ID:                 69589
 Updated by:         requinix@php.net
 Reported by:        guvenc at objexa dot com
 Summary:            calling abstract child static function from parent
                     constructor generates error
-Status:             Open
+Status:             Closed
 Type:               Bug
 Package:            Unknown/Other Function
 Operating System:   ubuntu
 PHP Version:        5.6Git-2015-05-07 (Git)
-Assigned To:        
+Assigned To:        requinix
 Block user comment: N
 Private report:     N

 New Comment:

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.
https://wiki.php.net/rfc/reclassify_e_strict#abstract_static_methods


Previous Comments:
------------------------------------------------------------------------
[2015-05-07 01:59:47] guvenc at objexa dot com

Description:
------------
calling a child classes static function from parent constructor generates error

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

}

Class B extens A{
  public function __construct(){
    parent::__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'


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=69589&edit=1


Thread (2 messages)

« previous php.bugs (#192543) next »