From: romain dot tartiere at healthgrid dot org
Operating system: GNU/Linux
PHP version: 5.2.3
PHP Bug Type: Class/Object related
Bug description: Derivating a method in a class that implements an interface
that declares it
Description:
------------
Considering a class that implements an interface and has methods that
require many arguments. You may expect to make your life easier derivating
this class and providing simpler methods.
Reproduce code:
---------------
<?php
interface i_foo {
function fooize($str, $n);
}
class c_foo implements i_foo { /* painful ($class->fooize($str, $n)) */
function fooize($str, $n) {
echo "$str $n\n";
}
}
class c_bar extends c_foo {
function fooize($str) { /* simple ($class->fooize($str)) */
$n = strlen($str);
parent::fooize($str, $n);
}
}
?>
Expected result:
----------------
This should not pose any kind of problem.
Actual result:
--------------
Fatal error: Declaration of c_bar::fooize() must be compatible with that
of i_foo::fooize()
--
Edit bug report at http://bugs.php.net/?id=42439&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=42439&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=42439&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=42439&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=42439&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=42439&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=42439&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=42439&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=42439&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=42439&r=support
Expected behavior: http://bugs.php.net/fix.php?id=42439&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=42439&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=42439&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=42439&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42439&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=42439&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=42439&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=42439&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=42439&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=42439&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=42439&r=mysqlcfg