ID: 50015 User updated by: shaselboeck at m-s dot de Reported By: shaselboeck at m-s dot de Status: Bogus Bug Type: Scripting Engine problem Operating System: Windows 2000 Server PHP Version: 5.2.11 New Comment:
Thanks! Previous Comments: ------------------------------------------------------------------------ [2009-10-27 11:50:02] johan...@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 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. ------------------------------------------------------------------------ [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