ID: 48984
User updated by: themastersleader at hotmail dot com
Reported By: themastersleader at hotmail dot com
Status: Bogus
Bug Type: Class/Object related
Operating System: Win XP
PHP Version: 5.3.0
New Comment:
I think it is a bug, someone else tested it in php 5.2.9 and then it
worked, 5.3.0 gives problems.
Greets
Previous Comments:
------------------------------------------------------------------------
[2009-07-21 11:39:06] themastersleader at hotmail dot com
Can someone explain why it isn't a bug?
How to work arround this?
Don't use interfaces isn't a real solution.
Thanks
Sander)
------------------------------------------------------------------------
[2009-07-20 11:07:56] themastersleader at hotmail dot com
I don't understand why this isn't a bug,
When i remove the interface everything works fine,
So by implementing an interface, we say "Implement the same parameters
of the private methods that are defined in the base class, with
exception that the access modifier can be different".
This isn't normal behaviour.
Greets
Sander)
------------------------------------------------------------------------
[2009-07-20 10:56:01] jani@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
------------------------------------------------------------------------
[2009-07-20 10:24:42] themastersleader at hotmail dot com
I noticed when the functions have the same params, everything works
fine.)
------------------------------------------------------------------------
[2009-07-20 10:01:56] themastersleader at hotmail dot com
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 this bug report at http://bugs.php.net/?id=48984&edit=1