Bug #46851 [Com]: Strict standards: Declaration of ... should be compatible with that of ...

From: Date: Sun, 11 Jul 2010 12:48:06 +0000
Subject: Bug #46851 [Com]: Strict standards: Declaration of ... should be compatible with that of ...
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-152268@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=46851&edit=1 ID: 46851 Comment by: david at customcode dot co dot za 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: Surely this counts as a bug when you consider it in the context of applications that make extensive use autoload. I realise I am a bit late to this party but from what I can see the strict standard was changed in php 5.2.10 but I can't seem to find any mention of this change in the changelog. This appears to be a fairly major change potentially affecting alot of people's code. I would expect at least some documentation of the rationale behind the change and at least some guidelines. That being said, surely when it comes to ensuring that classes are loaded/compiled in the correct order, classes that needed to be autoloaded should be loaded first before the child class is compiled. Or am I missing something? Previous Comments: ------------------------------------------------------------------------ [2010-06-30 09:48:04] colder@php.net It is simply related to the fact that if the classes are in the right order, they get defined at compile time and hence that strict error happens at compile-time, which is before you actually set to display E_STRICT. ------------------------------------------------------------------------ [2010-06-30 03:13:07] mauricio at yoreparo dot com Also tried on PHP 5.3.2, an issue too. thanks ------------------------------------------------------------------------ [2010-06-30 02:18:48] mauricio at yoreparo dot com Still an issue on 5.2.13 when autoloading classes. Oliver code still triggers the STRICT error: <?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(); ?> If I autoload the 'c' class the I get the STRICT error. ------------------------------------------------------------------------ [2010-05-28 17:24:46] travis dot crowder at spechal dot com 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 ------------------------------------------------------------------------ [2008-12-17 11:12:04] bjori@php.net Set error_reporting in your php.ini and you'll see the error. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/bug.php?id=46851 -- Edit this bug report at http://bugs.php.net/bug.php?id=46851&edit=1

« previous php.bugs (#152268) next »