From:             phpbug at gb404 dot com
Operating system: Gentoo Linux 2.4.23
PHP version:      5.0.0RC2
PHP Bug Type:     Zend Engine 2 problem
Bug description:  Incomplete error message when instantiating child classes of an 
abstract class

Description:
------------
When I try to instantiate a class which extends an abstract class but
without implemented all defined abstract functions, this class becomes
abstract too and fatal error message returned doesn't give any reason.

Then it is very difficult to find which abstract function is not
implemented as defined in the abstract parent class when there is a lot of
abstract functions to implement.

Is it possible to display a list of the missing function after the actual
error message ?

Reproduce code:
---------------
<?php
        abstract class a
        {
                abstract function foo();
                abstract function bar();
        }

        class b extends a
        {
                function foo() {
                        return "I am the foo function";
                }
        }

        $obj = new b();
?>

Expected result:
----------------
Fatal error: Cannot instantiate class b, abstract function parent::bar not
implemented in /absolute/path/to/my/file/b.php on line 15

Actual result:
--------------
Fatal error: Cannot instantiate abstract class b in
/absolute/path/to/my/file/b.php on line 15

-- 
Edit bug report at http://bugs.php.net/?id=28269&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=28269&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=28269&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=28269&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=28269&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=28269&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=28269&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=28269&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=28269&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=28269&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=28269&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=28269&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=28269&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28269&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=28269&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=28269&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=28269&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=28269&r=float

Reply via email to