Re: E_STRICT on inheritance + method parameter defaults?

From: Date: Wed, 21 Sep 2005 17:30:02 +0000
Subject: Re: E_STRICT on inheritance + method parameter defaults?
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-19111@lists.php.net to get a copy of this message
Hello Sean, Wednesday, September 21, 2005, 4:54:31 PM, you wrote: > Hello all, > This crept up as the result of a bug report (not mine -- > http://bugs.php.net/34494), and a small discussion on IRC: > Why does an E_STRICT get raised when extending a class, and altering the > method's proto defaults? I understand why it would be thrown when > adding/changing parameters, but why when simply changing $foo to $foo=1 ? > Honest question -- I'm not trying to change the behavior, here. It > doesn't seem "correct" to me, but I look forward to an explanation that > I've simply overlooked. > S marcus@zaphod /usr/src/PHP_5_1 $ php -r 'class T{function f($x){}} class U extends T{function f($x=2){}}' make: `sapi/cli/php' is up to date. Strict Standards: Declaration of U::f() should be compatible with that of T::f() in Command line code on line 1 marcus@zaphod /usr/src/PHP_5_1 $ php -r 'class T{function f($x=1){}} class U extends T{function f($x=2){}}' make: `sapi/cli/php' is up to date. The above shows php is correct here. Best regards, Marcus

« previous php.internals (#19111) next »