ID:               48804
 Updated by:       fel...@php.net
 Reported By:      christian dot achatz at adventure-php-framework
-Status:           Open
+Status:           Bogus
 Bug Type:         Class/Object related
 Operating System: CentOS 5.3 (final)
 PHP Version:      5.3.0
 New Comment:

This error is due the default value required for the param., not
because the variable name.


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

[2009-07-05 15:49:34] christian dot achatz at adventure-php-framework

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

Reply via email to