ID: 50897
User updated by: frederic dot hardy at mageekbox dot net
-Summary: require() of classes causes E_STRICT notice when
inlining same classes does not
Reported By: frederic dot hardy at mageekbox dot net
Status: Open
Bug Type: Scripting Engine problem
Operating System: *
PHP Version: 5.*, 6
New Comment:
Why the notice should be output in all cases ?
It's not a problem if b::test() has a signature wich is different from
a::test().
If it's a problem, what is the interest of extends b from a, or more
globaly, what is the interest of inheritance if you can not override
method with different signature ?
Previous Comments:
------------------------------------------------------------------------
[2010-02-01 12:21:08] [email protected]
And the notice should be output in all cases..
------------------------------------------------------------------------
[2010-02-01 12:19:49] [email protected]
Yes, but the order should not matter, that was my point. :)
------------------------------------------------------------------------
[2010-02-01 12:08:42] mvalleton at sauf dot ca
The problem isn't related with the order in which you declare classes a
and b:
The warning appears when classes a and b are declared in the *correct*
order, but in a different file, and then required by the main script.
Here is a simple example: http://ssz.fr/brdl/php-bug-50897.tbz2
classes.php:
<?php
class a {public function test($foo) {}}
class b extends a {public function test($foo, $bar) {}}
?>
script.php:
<?php
error_reporting(E_STRICT);
require "classes.php";
$b = new b();
?>
------------------------------------------------------------------------
[2010-02-01 11:59:52] [email protected]
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();
?>
------------------------------------------------------------------------
[2010-02-01 10:30:33] frederic dot hardy at mageekbox dot net
the "b" class must extends the "a" class, all my apologize.
------------------------------------------------------------------------
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/50897
--
Edit this bug report at http://bugs.php.net/?id=50897&edit=1