ID:               49177
 Updated by:       j...@php.net
-Summary:          include() causes strict erros when including
                   overloading methods
 Reported By:      ss at zornig dot dk
-Status:           Open
+Status:           Verified
 Bug Type:         Scripting Engine problem
-Operating System: FreeBSD
+Operating System: *
-PHP Version:      5.2.10
+PHP Version:      5.2 (SVN-2009-08-05)


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

[2009-08-06 12:03:08] ss at zornig dot dk

Description:
------------
When overloading a method, changing a parameter to accept a default
value  E_STRICT error is triggered. This however only happens if the
object declaration is loading using include, not if the declaration is
in the file called.

Reproduce code:
---------------
test.php:
<?php
error_reporting(E_ALL | E_STRICT);

abstract class ObjParent {
        public function set($param1, $param2){ }
}

require_once('obj.php');
?>

obj.php:
<?php
class ObjChild extends ObjParent {
        public function set($param1, $param2=true){ }
}
?>


Expected result:
----------------
This should be without any errors as i would if the test.php looks like
this:

<?php
error_reporting(E_ALL | E_STRICT);

abstract class ObjParent {
        public function set($param1, $param2){ }
}

class ObjChild extends ObjParent {
        public function set($param1, $param2=true){ }
}
?>

Actual result:
--------------
Strict Standards: Declaration of ObjChild::set() should be compatible
with that of ObjParent::set() in /home/webroot/dumpsite/obj.php on line
8


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=49177&edit=1

Reply via email to