From: shaselboeck at m-s dot de Operating system: Windows 2000 Server PHP version: 5.2.11 PHP Bug Type: Scripting Engine problem Bug description: Overwriting method of parent class with additional parameters. Strict standards
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 bug report at http://bugs.php.net/?id=50015&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=50015&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=50015&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=50015&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=50015&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=50015&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=50015&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=50015&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=50015&r=needscript Try newer version: http://bugs.php.net/fix.php?id=50015&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=50015&r=support Expected behavior: http://bugs.php.net/fix.php?id=50015&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=50015&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=50015&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=50015&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50015&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=50015&r=dst IIS Stability: http://bugs.php.net/fix.php?id=50015&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=50015&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=50015&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=50015&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=50015&r=mysqlcfg