#48984 [NEW]: Strict errors when implementing an interface (with private methods)

From: Date: Mon, 20 Jul 2009 10:01:56 +0000
Subject: #48984 [NEW]: Strict errors when implementing an interface (with private methods)
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-139953@lists.php.net to get a copy of this message
From:             themastersleader at hotmail dot com
Operating system: Win XP
PHP version:      5.3.0
PHP Bug Type:     Class/Object related
Bug description:  Strict errors when implementing an interface (with private methods)

Description:
------------
When we implement an interface,
And we have a base class with a private function,
We can't use that name anymore for a public function in classes that
extend the base class.

When we remove the implements everything works fine.

Reproduce code:
---------------
<?php 
error_reporting( E_ALL );
set_error_handler('errorReporting');

interface test { }

class ParentClass
implements test
{
	private function foo() { }
}

class ChildClass
extends ParentClass
{
	public function foo(array $content) { }
}

function errorReporting($errno, $errstr, $errfile, $errline)
{
	echo($errstr . '<br />');
}
?>

Expected result:
----------------
No error messages

Actual result:
--------------
Declaration of ChildClass::foo() should be compatible with that of
ParentClass::foo()

-- 
Edit bug report at http://bugs.php.net/?id=48984&edit=1
-- 
Try a snapshot (PHP 5.2):            http://bugs.php.net/fix.php?id=48984&r=trysnapshot52
Try a snapshot (PHP 5.3):            http://bugs.php.net/fix.php?id=48984&r=trysnapshot53
Try a snapshot (PHP 6.0):            http://bugs.php.net/fix.php?id=48984&r=trysnapshot60
Fixed in SVN:                        http://bugs.php.net/fix.php?id=48984&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=48984&r=needdocs
Fixed in release:                    http://bugs.php.net/fix.php?id=48984&r=alreadyfixed
Need backtrace:                      http://bugs.php.net/fix.php?id=48984&r=needtrace
Need Reproduce Script:               http://bugs.php.net/fix.php?id=48984&r=needscript
Try newer version:                   http://bugs.php.net/fix.php?id=48984&r=oldversion
Not developer issue:                 http://bugs.php.net/fix.php?id=48984&r=support
Expected behavior:                   http://bugs.php.net/fix.php?id=48984&r=notwrong
Not enough info:                     http://bugs.php.net/fix.php?id=48984&r=notenoughinfo
Submitted twice:                     http://bugs.php.net/fix.php?id=48984&r=submittedtwice
register_globals:                    http://bugs.php.net/fix.php?id=48984&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=48984&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=48984&r=dst
IIS Stability:                       http://bugs.php.net/fix.php?id=48984&r=isapi
Install GNU Sed:                     http://bugs.php.net/fix.php?id=48984&r=gnused
Floating point limitations:          http://bugs.php.net/fix.php?id=48984&r=float
No Zend Extensions:                  http://bugs.php.net/fix.php?id=48984&r=nozend
MySQL Configuration Error:           http://bugs.php.net/fix.php?id=48984&r=mysqlcfg



Thread (15 messages)

« previous php.bugs (#139953) next »