ID:               50925
 Updated by:       [email protected]
 Reported By:      pieterbregman1982 at gmail dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Class/Object related
 Operating System: Windows
 PHP Version:      5.3.1
 New Comment:

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


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

[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

Reply via email to