#46851 [Opn->Bgs]: Strict standards: Declaration of ... should be compatible with that of ...

From: Date: Wed, 17 Dec 2008 11:12:05 +0000
Subject: #46851 [Opn->Bgs]: Strict standards: Declaration of ... should be compatible with that of ...
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-132113@lists.php.net to get a copy of this message
 ID:               46851
 Updated by:       bjori@php.net
 Reported By:      oliver at teqneers dot de
-Status:           Open
+Status:           Bogus
 Bug Type:         Scripting Engine problem
 Operating System: OpenSuSE 11.0
 PHP Version:      5.2.8
 New Comment:

Set error_reporting in your php.ini and you'll see the error.



Previous Comments:
------------------------------------------------------------------------

[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/?id=46851&edit=1



Thread (18 messages)

« previous php.bugs (#132113) next »