ID: 50925 User updated by: pieterbregman1982 at gmail dot com Reported By: pieterbregman1982 at gmail dot com Status: Bogus Bug Type: Class/Object related Operating System: Windows PHP Version: 5.3.1 New Comment:
Sorry for submitting the bug more than once. I've read the bug report and I understand now why test1.php doesn't show strict warnings and test2.php does. What I don't understand, is the reason behind the strict error. What is the use of extending classes when it's not allowed to override methods in the child classes with different parameters? This is also mentioned in http://bugs.php.net/bug.php?id=50897 but it remains unanswered. Searching the bug database, I found this bug: http://bugs.php.net/bug.php?id=49177 Does the status "verified" mean that the method overriding issue has your attention? If so, is there any news around this issue? Previous Comments: ------------------------------------------------------------------------ [2010-02-03 12:05:37] [email protected] Please do not submit the same bug more than once. An existing bug report already describes this very problem. Even if you feel that your issue is somewhat different, the resolution is likely to be the same. Thank you for your interest in PHP. See bug #50897 ------------------------------------------------------------------------ [2010-02-03 10:55:34] pieterbregman1982 at gmail dot com Description: ------------ PHP reports a strict error when classes are being included using include() (or require()). This error doesn't come up when the classes are in the scope allready by inlining them in the same file that makes the calls to the classes. I can't figure out why the error only occurs when the classes are being included by using include() Reproduce code: --------------- test1.php (This code gives no strict errors) <?php ini_set('display_errors', '1'); error_reporting(-1); abstract class Model { public function create() { echo __CLASS__; } } class Person extends Model { public function create($name) { echo $name; } } $person = new Person(); $person->create('Foo'); ?> test2.php (This code does give a strict error) <?php ini_set('display_errors', '1'); error_reporting(-1); include_once 'Model.php'; include_once 'Person.php'; $person = new Person(); $person->create('Foo'); ?> Model.php <?php abstract class Model { public function create() { echo __CLASS__; } } ?> Person.php <?php class Person extends Model { public function create($name) { echo $name; } } ?> Expected result: ---------------- I would expect that both tests don't give strict errors. Actual result: -------------- test02.php - Strict error: Strict standards: Declaration of Person::create() should be compatible with that of Model::create() in Person.php on line 6 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=50925&edit=1
