php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #66818 PHP Fatal error: Can't inherit abstract function
Submitted: 2014-03-04 09:37 UTC Modified: 2014-03-04 11:26 UTC
From: oxygenus at gmail dot com Assigned:
Status: Not a bug Package: Class/Object related
PHP Version: Irrelevant OS: Linux
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.
Password:
Status:
Package:
Bug Type:
Summary:
From: oxygenus at gmail dot com
New email:
PHP Version: OS:

 

 [2014-03-04 09:37 UTC] oxygenus at gmail dot com
Description:
------------
Works on Windows 8 x64 with PHP 5.3.1 and PHP 5.5.9.
Fails on Linux with PHP 5.3.1 and 5.3.3. I do not have a Linux available with a newer PHP version.



Test script:
---------------
<?php
interface iInherit
{
	public function inheritMe();
}

abstract class InheritBase implements iInherit
{
	abstract public function inheritMe();
}

class Child extends InheritBase
{
	public function inheritMe()
	{
	}
}

Expected result:
----------------
Expecting a successfull compilation.

Actual result:
--------------
PHP Fatal error:  Can't inherit abstract function iInherit::inheritMe() (previously declared abstract in InheritBase) in test.php on line 8

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-03-04 09:39 UTC] oxygenus at gmail dot com
Note weird behaviour (not reproduced by provided script): the parser complains about InheritBase not beeing able to inherit "inheritMe()" from InheritBase.
In short, it appears to be attempting to inherit from itself.
 [2014-03-04 11:26 UTC] nikic@php.net
-Status: Open +Status: Not a bug
 [2014-03-04 11:26 UTC] nikic@php.net
This appears fixed as of PHP 5.3.9, see http://3v4l.org/NP9Be. Please use current, or at least supported, versions of PHP when reporting bugs.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 16:01:31 2024 UTC