From: gerald at copix dot org
Operating system: Linux
PHP version: 5.2.1
PHP Bug Type: Class/Object related
Bug description: Interface, Abstract Class & Methods
Description:
------------
When we want to implement an interface in a child class that extends an
abstract class that contains an abstract method that is in the interface,
we get an error.
This kind of bug has already been submited in #35057 and was marked as
bogus because AClasse::show obviously is not the same as IClasse::show.
But in the code we only say that IClasse::show is the same as
AClasseConcrete::show.
To me, the IClasse should not care how AClasseConcrete manage to
implements the interface. The important thing is that AClasseConcrete::show
IS the same as IClasse::show.
I've checked the documentation and was not able to find this exact case
and I've try this concept in other langages (like Java) with success.
I think at least it should be discussed.
If it has been discussed already, I'm really sorry for the time I made you
spent on this.
Greatings
Reproduce code:
---------------
interface IClasse {
public function show ();
}
abstract class AClasse {
abstract public function show ();
}
class AClasseConcrete extends AClasse implements IClasse {
public function show (){
echo "Everything is ok";
}
}
$classe = new AClasseConcrete ();
$classe->show ();
Expected result:
----------------
"Everything is ok"
Actual result:
--------------
Fatal error: Can't inherit abstract function IClasse::show() (previously
declared abstract in AClasse) in
/home/geraldc/workspace/Copix_3/www/syntax_playground.php
--
Edit bug report at http://bugs.php.net/?id=41145&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=41145&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=41145&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=41145&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=41145&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=41145&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=41145&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=41145&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=41145&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=41145&r=support
Expected behavior: http://bugs.php.net/fix.php?id=41145&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=41145&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=41145&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=41145&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=41145&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=41145&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=41145&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=41145&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=41145&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=41145&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=41145&r=mysqlcfg