From: christian dot achatz at adventure-php-framework dot org Operating system: CentOS 5.3 (final) PHP version: 5.3.0 PHP Bug Type: Class/Object related Bug description: Overriding results in declaration error
Description: ------------ As of PHP 5.3.0 my custom class (PageControllerInputFilter) is not compiling any more. Reason for this is: Declaration of PageControllerInputFilter::filter() should be compatible with that of AbstractFilter::filter(). Rewriting the filter() function to signature "filter($filterInstruction,$input = null)" would solve the problem, but this is no implementation of the filter() method (e.g. interface behaviour) on PageControllerInputFilter, but overriding. Hence, the name of the variables must not be spellt equally. Even in JAVA, you can freely choose your variable names when overriding a method from a super-class. Tests were executed using PHP compiled from source on my centos machine using [r...@centos53 ~]# md5sum /root/php53-source/php-5.3.0.tar.bz2 846760cd655c98dfd86d6d97c3d964b0 /root/php53-source/php-5.3.0.tar.bz2 [r...@centos53 ~]# ./configure --with-apxs2=$(which apxs) --prefix=/root/php53/ --with-zlib --without-pear [r...@centos53 ~]# make [r...@centos53 ~]# make install Reproduce code: --------------- abstract class AbstractFilter extends coreObject { function AbstractFilter(){ } function filter($filterInstruction,$input = null){ return $input; } } class PageControllerInputFilter extends AbstractFilter { function PageControllerInputFilter(){ } function filter($instruction,$content){ return $content; } } Definition of the class coreObject can be seen here: http://adventurephpfra.svn.sourceforge.net/viewvc/adventurephpfra/branches/php5/1.10/core/pagecontroller/pagecontroller.php?revision=573&view=markup Expected result: ---------------- No fatal, no declaration warning. Actual result: -------------- Declaration of PageControllerInputFilter::filter() should be compatible with that of AbstractFilter::filter(). Fatal error: Class 'PageControllerInputFilter' not found in /var/www/html/php53/apps/core/filter/PageControllerInputFilter.php on line 82. Package to test this behaviour can be found here: http://media.adventure-php-framework.org/php53/adventure-demopack-1.10-RC1-2009-07-05-1404-php5.tar.gz. Just extract into document root and call via browser. -- Edit bug report at http://bugs.php.net/?id=48804&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=48804&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=48804&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=48804&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=48804&r=fixedcvs Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=48804&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=48804&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=48804&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=48804&r=needscript Try newer version: http://bugs.php.net/fix.php?id=48804&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=48804&r=support Expected behavior: http://bugs.php.net/fix.php?id=48804&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=48804&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=48804&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=48804&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=48804&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=48804&r=dst IIS Stability: http://bugs.php.net/fix.php?id=48804&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=48804&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=48804&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=48804&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=48804&r=mysqlcfg