|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2010-05-20 09:33 UTC] mike@php.net
[2010-05-20 10:18 UTC] ss at zornig dot dk
[2010-05-20 10:53 UTC] johannes@php.net
[2010-05-20 10:58 UTC] johannes@php.net
-Status: Open
+Status: Bogus
[2010-05-20 10:58 UTC] johannes@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Nov 21 05:00:01 2025 UTC |
Description: ------------ When overloading a method, changing a object type hint to accept a child class instead a E_STRICT error is triggered. This however only happens if the object declaration is loaded using include, not if the declaration is in the file called. Test script: --------------- test.php: <?php error_reporting(E_ALL | E_STRICT); abstract class ObjParent { public function set(ObjParent $param1, $param2){ } } require_once('obj.php'); ?> obj.php: <?php class ObjChild extends ObjParent { public function set(ObjChild $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(ObjParent $param1, $param2){ } } class ObjChild extends ObjParent { public function set(ObjChild $param1, $param2){ } } ?> Actual result: -------------- Strict Standards: Declaration of ObjChild::set() should be compatible with that of ObjParent::set() in /usr/home/webroot/dumpsite/bug/obj.php on line 4