ID: 49162
Updated by: [email protected]
Reported By: wjaspers4 at gmail dot com
-Status: Open
+Status: Bogus
Bug Type: Class/Object related
Operating System: Windows XP SP3 (32-bit)
PHP Version: 5.2.10
New Comment:
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same.
Thank you for your interest in PHP.
Previous Comments:
------------------------------------------------------------------------
[2009-08-05 02:41:06] wjaspers4 at gmail dot com
Description:
------------
In proper OOP, i should be able to define an interface, and have a
class
or abstract class implement it.
If I create a class (or abstract class) which calls upon the interface
in a method signature, everything is ok.
However; if I extend the aforementioned class (or extend unto an
abstract class), and I call upon the class which implements the
interface, my compilation fails.
Even if I provide a method in my interface and implement it in the
class
which uses the interface, it still fails.
I have been able to reproduce this in both php 5.2.10 and 5.2.6
(personal and work servers, respectively)
Reproduce code:
---------------
interface Validatable {};
class Form implements Validatable
{
}
abstract class Validator
{
abstract public function Validate( Validatable $v );
}
abstract class Form_Validator
extends Validator
{
public function Validate( Form $f )
{ // do something in here...
}
}
Expected result:
----------------
I should see nothing.
OR -- if i look in memory, I should see that my Form_Validator has a
Validate method in it.
Actual result:
--------------
Fatal error: Declaration of Form_Validator::Validate() must be
compatible with that of Validator::Validate() in ....
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=49162&edit=1