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

From: Date: Wed, 30 Jun 2010 01:13:08 +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-151972@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:       mauricio at yoreparo 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:

Also tried on PHP 5.3.2, an issue too.

thanks


Previous Comments:
------------------------------------------------------------------------
[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.


------------------------------------------------------------------------
[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


Thread (18 messages)

« previous php.bugs (#151972) next »