#50015 [Opn->Bgs]: Overwriting method of parent class with additional parameters. Strict standards
| From: | johannes@php.net | Date: | Tue, 27 Oct 2009 11:50:04 +0000 |
| Subject: | #50015 [Opn->Bgs]: Overwriting method of parent class with additional parameters. Strict standards | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-144011@lists.php.net to get a copy of this message | ||
ID: 50015
Updated by: johannes@php.net
Reported By: shaselboeck at m-s dot de
-Status: Open
+Status: Bogus
Bug Type: Scripting Engine problem
Operating System: Windows 2000 Server
PHP Version: 5.2.11
New Comment:
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
In the second case the message is produced while compiling the script,
before the error_reporting() function call happens. Set the
error_reporting level in your php.ini and you will see the notice in
both cases.
Previous Comments:
------------------------------------------------------------------------
[2009-10-27 10:53:55] shaselboeck at m-s dot de
Description:
------------
If I turn on E_STRICT, I get a strict notice depending on class
position. The notice is as following:
Strict standards: Declaration of ... should be compatible with that of
...
Maybe this notice is correct, but if I switch the classes in my code
without changing their content, this notice is gone. Exactly here is
the bug.
In example A and B the method someFunc() of child class is not
compatible with that of parent class. But only in example A occurs an
error (Strict standards... see above)
Reproduce code:
---------------
<?php
error_reporting(E_ALL | E_STRICT);
/**
* Example A: error occurs
*/
class Child_A extends Parent_A
{
public function someFunc($param) {}
}
class Parent_A
{
public function someFunc() {}
}
$child = new Child_A();
/**
* Example B: no error occurs
*/
class Parent_B
{
public function someFunc() {}
}
class Child_B extends Parent_B
{
public function someFunc($param) {}
}
$child = new Child_B();
Expected result:
----------------
Either both examples (A and B ) should trigger an error or no one of
them.
Parent classes should be parsed before child classes which extends
parent classes.
Actual result:
--------------
Code example A triggers an error:
Strict Standards: Declaration of Child_A::someFunc() should be
compatible with that of Parent_A::someFunc() in
E:\...\class_extending_test.php on line 7
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=50015&edit=1