#50897 [Opn]: Require() problem with E_STRICT
| From: | jani@php.net | Date: | Mon, 01 Feb 2010 13:08:07 +0000 |
| Subject: | #50897 [Opn]: Require() problem with E_STRICT | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-147098@lists.php.net to get a copy of this message | ||
ID: 50897
Updated by: jani@php.net
Reported By: frederic dot hardy at mageekbox dot net
Status: Open
Bug Type: Scripting Engine problem
Operating System: *
PHP Version: 5.*, 6
New Comment:
If you feel it's a problem, don't put E_STRICT in your
error_reporting..
Previous Comments:
------------------------------------------------------------------------
[2010-02-01 12:27:11] frederic dot hardy at mageekbox dot net
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 ?
------------------------------------------------------------------------
[2010-02-01 12:21:08] jani@php.net
And the notice should be output in all cases..
------------------------------------------------------------------------
[2010-02-01 12:19:49] jani@php.net
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] jani@php.net
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();
?>
------------------------------------------------------------------------
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