Edit report at http://bugs.php.net/bug.php?id=46851&edit=1
ID: 46851 Comment by: travis dot crowder at spechal dot com Reported by: oliver at teqneers dot de Summary: Strict standards: Declaration of ... should be compatible with that of ... Status: Bogus Type: Bug Package: Scripting Engine problem Operating System: OpenSuSE 11.0 PHP Version: 5.2.8 New Comment: Still an issue in 5.2.10 <?php error_reporting(E_ALL | E_STRICT); abstract class B extends A { public static function foo($str){ echo $str; } } class C extends A { public static function foo(){ echo 'baz'; } } abstract class A { public static function foo(){ echo 'bar'; } } C::foo(); Error: Strict Standards: Declaration of B::foo() should be compatible with that of A::foo() in /var/www/oop_test.php on line 5 Previous Comments: ------------------------------------------------------------------------ [2008-12-17 11:12:04] bj...@php.net Set error_reporting in your php.ini and you'll see the error. ------------------------------------------------------------------------ [2008-12-12 16:08:09] oliver at teqneers 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?!? This is a problem when using autoload, because it might happen, that a subclass is loaded before the parent class has been parsed. Reproduce code: --------------- <?php // this code does trigger a strict message error_reporting( E_ALL | E_STRICT ); class cc extends c { function test() { return null; } } class c { function test( $a ) { return 1; } } $cc = new cc(); ?> <?php // this code does NOT trigger a strict message error_reporting( E_ALL | E_STRICT ); class c { function test( $a ) { return 1; } } class cc extends c { function test() { return null; } } $cc = new cc(); ?> Expected result: ---------------- None of the code blocks should trigger an error (my personal preference) or both code blocks must trigger a notice. Actual result: -------------- First block triggers: Strict standards: Declaration of cc::test() should be compatible with that of c::test() in strict_test.php on line 4 Second does nothing at all. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=46851&edit=1