Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:19114 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 56439 invoked by uid 1010); 21 Sep 2005 22:28:08 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 56422 invoked from network); 21 Sep 2005 22:28:08 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Sep 2005 22:28:08 -0000 X-Host-Fingerprint: 81.169.182.136 ajaxatwork.net Linux 2.4/2.6 Received: from ([81.169.182.136:42020] helo=strato.aixcept.de) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id CA/C2-24510-77ED1334 for ; Wed, 21 Sep 2005 18:28:07 -0400 Received: from [192.168.1.3] (dsl-082-083-229-040.arcor-ip.net [82.83.229.40]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by strato.aixcept.de (Postfix) with ESMTP id 9A90835C384; Thu, 22 Sep 2005 00:51:32 +0200 (CEST) Date: Thu, 22 Sep 2005 00:28:07 +0200 Reply-To: Marcus Boerger X-Priority: 3 (Normal) Message-ID: <308721083.20050922002807@marcus-boerger.de> To: Christian Schneider Cc: internals In-Reply-To: <4331C46D.9030408@cschneid.com> References: <43317427.8010205@caedmon.net> <1059969811.20050921193002@marcus-boerger.de> <4331C46D.9030408@cschneid.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] E_STRICT on inheritance + method parameter defaults? From: helly@php.net (Marcus Boerger) Hello Christian, Wednesday, September 21, 2005, 10:37:01 PM, you wrote: > Marcus Boerger wrote: >> 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. > In my opinion Sean didn't ask whether PHP behaves that way but _why_. The above example show that adding a default result value in a derived class results in an incompatible signature while changing it works as expected. Best regards, Marcus