ID:               28269
 Updated by:       [EMAIL PROTECTED]
 Reported By:      phpbug at gb404 dot com
 Status:           Open
 Bug Type:         Feature/Change Request
 Operating System: *
-PHP Version:      5.0.0RC2
+PHP Version:      5.0.2
 New Comment:

Abstract redefinition is a feature request - the rest was fixed in
5.0.0


Previous Comments:
------------------------------------------------------------------------

[2004-09-25 00:21:59] [EMAIL PROTECTED]

Abstract redefinition is a feature request - the rest was fixed in
5.0.0

------------------------------------------------------------------------

[2004-09-24 17:46:25] bobalong at gmx dot net

IMO it's not really a problem with instantiation. The perfect solution
would be if a compile-time error was thrown asking the developer to
implement the missing method(s), or declare the class abstract, just as
is done when partially implementing an interface in a class that is not
declared abstract.

As a side note on this issue, another nice feature that would make a
lot of PHP5 OO code more readable and intuitave would be the allowance
by the parser for the re-declaration of abstract functions. At the
moment the usual "cannot re-dfeine function" message gets thrown. This
just needs to ignore abstract functions (in abstract classes), i.e.

interface a
{
        function foo();
}

abstract class b implements a
{
        abstract function foo();
}

class c extends b
{
        function foo()
        {
                // do something...
        }
}

------------------------------------------------------------------------

[2004-05-19 14:27:07] cunha at gabcmt dot eb dot mil dot br

I'm experiencing the same problem. It's very difficult to discover the
missing method if PHP doesn't give any hint. 

The message given for the first class that "implements" some interface
is complete and has IMHO all necessary information to the programmer.
But the message given for any subclasses is generic and doesn't tell
which methods are missing and why.

------------------------------------------------------------------------

[2004-05-04 05:44:00] phpbug at gb404 dot com

This is not specific to linux

------------------------------------------------------------------------

[2004-05-04 03:43:23] phpbug at gb404 dot com

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 this bug report at http://bugs.php.net/?id=28269&edit=1

Reply via email to