From: Fahr at lycantrope dot com Operating system: FreeBSD 7.0 PHP version: 5.2.5 PHP Bug Type: Scripting Engine problem Bug description: introducing default params values in overridden methods throws E_STRICT
Description: ------------ Introducing a parameter with a default value in a function of a derived class, where the function in the parent does not have a default value, throws an E_STRICT. Introducing a default does NOT change the function's signature and should not cause any problems. It is possible in C++ and most other OO languages without any issues. In PHP it causes an E_STRICT to be thrown. This is especially an issue when working with third party libraries (i.e. Smarty) that need to be overridden to have defaults (i.e. display()/fetch()). This works fine, but does throw an E_STRICT. Reproduce code: --------------- class Parent { public function foo($bar) { } } class Child extends Parent { public function foo($bar = "test") { } } Expected result: ---------------- No E_STRICT thrown Actual result: -------------- E_STRICT thrown -- Edit bug report at http://bugs.php.net/?id=44318&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=44318&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=44318&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=44318&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=44318&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=44318&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=44318&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=44318&r=needscript Try newer version: http://bugs.php.net/fix.php?id=44318&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=44318&r=support Expected behavior: http://bugs.php.net/fix.php?id=44318&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=44318&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=44318&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=44318&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=44318&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=44318&r=dst IIS Stability: http://bugs.php.net/fix.php?id=44318&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=44318&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=44318&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=44318&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=44318&r=mysqlcfg