From: Operating system: FreeBSD 7.2 PHP version: 5.3.2 Package: Scripting Engine problem Bug Type: Bug Bug description:include() causes strict erros when including overloading methods
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 -- Edit bug report at http://bugs.php.net/bug.php?id=51867&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=51867&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=51867&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=51867&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=51867&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=51867&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=51867&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=51867&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=51867&r=needscript Try newer version: http://bugs.php.net/fix.php?id=51867&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=51867&r=support Expected behavior: http://bugs.php.net/fix.php?id=51867&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=51867&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=51867&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=51867&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=51867&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=51867&r=dst IIS Stability: http://bugs.php.net/fix.php?id=51867&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=51867&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=51867&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=51867&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=51867&r=mysqlcfg