From: henrik at bonest dot dk
Operating system: Windows XP
PHP version: 5.2.4
PHP Bug Type: Class/Object related
Bug description: Problem with abstract functions and classes
Description:
------------
An abstract class should hold one abstract methods.
The class that implements it, may not be declared abstract, but this
simple structure does not give the results expected
Reproduce code:
---------------
abstract class bizView {
abstract public function getHTML();
}
abstract class bizViewFront extends bizView
{
abstract public function getHTML();
public function somethingelse() {
echo "Something";
}
}
class bizViewOutput extends bizViewFront
{
public function getHTML() {
echo "HTML";
}
}
$test = new bizViewOutput();
$test->getHTML();
Expected result:
----------------
I would expect the text "HTML" to be printed, because the getHTML function
is implemented in the child class but declared abstract in the base
abstract classes.
This is a common OOP practice.
Actual result:
--------------
Fatal error: Can't inherit abstract function bizView::getHTML()
(previously declared abstract in bizViewFront)
--
Edit bug report at http://bugs.php.net/?id=43149&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=43149&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=43149&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=43149&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=43149&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=43149&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=43149&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=43149&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=43149&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=43149&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=43149&r=support
Expected behavior: http://bugs.php.net/fix.php?id=43149&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=43149&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=43149&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=43149&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=43149&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=43149&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=43149&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=43149&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=43149&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=43149&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=43149&r=mysqlcfg