ID: 50897 Updated by: j...@php.net Reported By: frederic dot hardy at mageekbox dot net -Status: Bogus +Status: Open Bug Type: Scripting Engine problem -Operating System: Freebsd 7.2/archlinux +Operating System: * -PHP Version: 5.3.1 +PHP Version: 5.*, 6 New Comment:
Not sure what's going on here, but this is the difference eventually: No E_STRICT notice: <?php error_reporting(E_STRICT); class a{function test($foo){}} class b extends a{function test($foo, $bar){}} $b = new b(); ?> E_STRICT notice <?php error_reporting(E_STRICT); class b extends a{function test($foo, $bar){}} class a{function test($foo){}} $b = new b(); ?> Previous Comments: ------------------------------------------------------------------------ [2010-02-01 11:40:09] frederic dot hardy at mageekbox dot net This bug was reproduce on several machine on several OS and PHP version without any problem. Please try http://medias.mageekbox.net/bug.tgz to reproduce it or use the code below : file a.php <?php class a { public function test($fool) {} } ?> file b.php <?php class b extends b { public function test($foo, $bar) {} } ?> file withRequire.php <?php error_reporting(E_STRICT); require('a.php'); require('b.php'); $b = new b(); ?> file allInOne.php <?php error_reporting(E_STRICT); class a { public function test($foo) {} } class b extends a { public function test($foo, $bar) {} } $b = new b(); ?> ------------------------------------------------------------------------ [2010-02-01 11:32:48] j...@php.net You must have something really really wrong somewhere in your setup if you get that error. I can not reproduce any of this. ------------------------------------------------------------------------ [2010-02-01 10:30:33] frederic dot hardy at mageekbox dot net the "b" class must extends the "a" class, all my apologize. ------------------------------------------------------------------------ [2010-02-01 10:20:08] frederic dot hardy at mageekbox dot net Description: ------------ Require() and include() are more strict than a all in one file then parse php code. Reproduce code: --------------- file a.php <?php class a { public function test($fool) {} } ?> file b.php <?php class b { public function test($foo, $bar) {} } ?> file withRequire.php <?php error_reporting(E_STRICT); require('a.php'); require('b.php'); $b = new b(); ?> file allInOne.php <?php error_reporting(E_STRICT); class a { public function test($foo) {} } class b [ public function test($foo, $bar) {} } $b = new b(); ?> Expected result: ---------------- In CLI, "php withRequire.php" must give same result than php "allInOne.php". Actual result: -------------- php allInOne.php => nothing php withRequire.php => Strict standards: Declaration of b::test() should be compatible with that of a::test() in /path/to/b.php on line 8 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=50897&edit=1