Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:49449 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 3877 invoked from network); 19 Aug 2010 08:13:12 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Aug 2010 08:13:12 -0000 Authentication-Results: pb1.pair.com header.from=smalyshev@sugarcrm.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=smalyshev@sugarcrm.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain sugarcrm.com designates 67.192.241.163 as permitted sender) X-PHP-List-Original-Sender: smalyshev@sugarcrm.com X-Host-Fingerprint: 67.192.241.163 smtp163.dfw.emailsrvr.com Linux 2.6 Received: from [67.192.241.163] ([67.192.241.163:49955] helo=smtp163.dfw.emailsrvr.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B2/60-04318-697EC6C4 for ; Thu, 19 Aug 2010 04:13:11 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp6.relay.dfw1a.emailsrvr.com (SMTP Server) with ESMTP id 936D127012D; Thu, 19 Aug 2010 04:13:08 -0400 (EDT) X-Virus-Scanned: OK Received: from [192.168.2.5] (c-76-103-56-123.hsd1.ca.comcast.net [76.103.56.123]) (Authenticated sender: smalyshev@sugarcrm.com) by smtp6.relay.dfw1a.emailsrvr.com (SMTP Server) with ESMTPSA id 2D4AE270121; Thu, 19 Aug 2010 04:13:08 -0400 (EDT) Message-ID: <4C6CE793.1020601@sugarcrm.com> Date: Thu, 19 Aug 2010 01:13:07 -0700 Organization: SugarCRM User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.1.11) Gecko/20100711 Thunderbird/3.0.6 MIME-Version: 1.0 To: Dave Ingram CC: PHP Internals References: <4C6CE273.2070501@sugarcrm.com> <4C6CE604.1010209@dmi.me.uk> In-Reply-To: <4C6CE604.1010209@dmi.me.uk> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] inheritance check too strict? From: smalyshev@sugarcrm.com (Stas Malyshev) Hi! > I was under the impression that, in order for inheritance to provide > proper polymorphism, overridden methods should share the parent's method > signature, although they can have additional optional arguments. Your impression is wrong. Overriden method should have _compatible_ signature - i.e. accept any argument set that parent object accepted. Nothing requires it to have the same signature. > Otherwise, if you're passed an ObjChild when you are treating it as an > ObjParent, you could get unexpected behaviour if it ignores $param2 when > you decide to specify it. PHP doesn't complain about a programmer Unexpected by whom? Writer of ObjChild->set() knew how to implement it without that parameter, so why behavior would be unexpected? > passing too many arguments to the function as far as I recall, so this > sort of bug can be easy to overlook. How this is a "bug"? -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227