ID:               44318
 Updated by:       [EMAIL PROTECTED]
 Reported By:      Fahr at lycantrope dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Scripting Engine problem
 Operating System: FreeBSD 7.0
 PHP Version:      5.2.5
 New Comment:

If you don't want to code in strict way, then remove E_STRICT from your
error_reporting setting in php.ini. This is not a bug. 


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

[2008-03-03 16:23:39] Fahr at lycantrope dot com

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 this bug report at http://bugs.php.net/?id=44318&edit=1

Reply via email to