Bug #69589 [Opn->Csd]: calling abstract child static function from parent constructor generates error
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)