#49162 [NEW]: Interfaces not Inherited in Method Signatures

From: Date: Wed, 05 Aug 2009 02:41:06 +0000
Subject: #49162 [NEW]: Interfaces not Inherited in Method Signatures
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-140662@lists.php.net to get a copy of this message
From: wjaspers4 at gmail dot com Operating system: Windows XP SP3 (32-bit) PHP version: 5.2.10 PHP Bug Type: Class/Object related Bug description: Interfaces not Inherited in Method Signatures 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 bug report at http://bugs.php.net/?id=49162&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=49162&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=49162&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=49162&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=49162&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=49162&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=49162&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=49162&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=49162&r=needscript Try newer version: http://bugs.php.net/fix.php?id=49162&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=49162&r=support Expected behavior: http://bugs.php.net/fix.php?id=49162&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=49162&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=49162&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=49162&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49162&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=49162&r=dst IIS Stability: http://bugs.php.net/fix.php?id=49162&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=49162&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=49162&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=49162&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=49162&r=mysqlcfg

« previous php.bugs (#140662) next »