|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-10-27 11:50 UTC] johannes@php.net
[2009-10-27 12:51 UTC] shaselboeck at m-s dot de
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Wed Mar 25 07:00:01 2026 UTC |
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