Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:25779 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 78120 invoked by uid 1010); 21 Sep 2006 02:15:21 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 78105 invoked from network); 21 Sep 2006 02:15:21 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Sep 2006 02:15:21 -0000 Received: from [127.0.0.1] ([127.0.0.1:12088]) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ECSTREAM id 2E/66-15260-9B5F1154 for ; Wed, 20 Sep 2006 22:15:21 -0400 Authentication-Results: pb1.pair.com header.from=jasper@albumltd.co.nz; sender-id=unknown; domainkeys=bad (key type) Authentication-Results: pb1.pair.com smtp.mail=jasper@albumltd.co.nz; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain albumltd.co.nz from 210.55.31.88 cause and error) DomainKey-Status: bad (key type) X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: jasper@albumltd.co.nz X-Host-Fingerprint: 210.55.31.88 unknown Linux 2.5 (sometimes 2.4) (4) Received: from [210.55.31.88] ([210.55.31.88:41551] helo=mail.albumltd.co.nz) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D8/06-15260-032F1154 for ; Wed, 20 Sep 2006 22:00:19 -0400 Received: from mail.albumltd.co.nz (www.album.co.nz [127.0.0.1]) by mail.albumltd.co.nz (Postfix) with ESMTP id 0A6301792; Thu, 21 Sep 2006 14:00:13 +1200 (NZST) DomainKey-Signature: a=rsa-sha1; h=Received:Message-ID:Date:From:Organization:User-Agent:MIME-Version:To:CC:Subject:References:In-Reply-To:X-Enigmail-Version:OpenPGP:Content-Type:Content-Transfer-Encoding; b=J4B3LDVA+VwVuiMIuT1/UneiVLfGIsmLjqm1jnkBdnanD61E/eUAHVYBtYXiV4OiY7HKNEBHIo3XAFOnfYQaAkEPLz1Z9Zysxn+5L3ebv3h5iDdDEmcH5F3hg7Bt6+VGo4lnCkob6rR2r7vUX8XlsT+A2tD0LW7xX7MofsJ7/U0=; c=nofws; d=albumltd.co.nz; q=dns; s=ks1 Received: from [10.0.1.1] (222-154-246-93.adsl.xtra.co.nz [222.154.246.93]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: jasper) by mail.albumltd.co.nz (Postfix) with ESMTP id 7F4BA1046; Thu, 21 Sep 2006 14:00:12 +1200 (NZST) Message-ID: <4511F22A.4060903@albumltd.co.nz> Date: Thu, 21 Sep 2006 14:00:10 +1200 Organization: Album Limited User-Agent: Thunderbird 1.5.0.5 (X11/20060719) MIME-Version: 1.0 To: Christian Schneider CC: PHP Developers Mailing List References: <4511925F.5060602@cschneid.com> In-Reply-To: <4511925F.5060602@cschneid.com> X-Enigmail-Version: 0.94.1.0 OpenPGP: id=0A3ABF58 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Parameter checking in 5.2 From: jasper@albumltd.co.nz (Jasper Bryant-Greene) -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 +1 Given that static methods apply to the class and don't have much in the way of inheritance rules, Christian's suggested behaviour makes a lot of sense. Jasper Christian Schneider wrote: > In the discussion about parameter checking in 5.2 I proposed to relax > the checks a tiny little bit: Don't test static functions (e.g. useful > for factory methods) and allow adding default values to functions (the > object of the inherited class still accepts the same parameters as the > base class). A patch is attached. > > Example: > class Base > { > static function factory($x) { } > function foo($x) { } > } > > class Spezialized extends Base > { > static function factory() { } # Static method, e.g. factory method > function foo($x = null) { } # Default values for specialized class > } > > Regards, > - Chris > > > ------------------------------------------------------------------------ > > Index: Zend/zend_compile.c > =================================================================== > RCS file: /repository/ZendEngine2/zend_compile.c,v > retrieving revision 1.647.2.27.2.18 > diff -u -r1.647.2.27.2.18 zend_compile.c > --- Zend/zend_compile.c 19 Sep 2006 21:36:53 -0000 1.647.2.27.2.18 > +++ Zend/zend_compile.c 20 Sep 2006 19:05:43 -0000 > @@ -1922,13 +1922,12 @@ > } > > /* Checks for constructors only if they are declared in an interface */ > - if ((fe->common.fn_flags & ZEND_ACC_CTOR) && !(proto->common.scope->ce_flags & ZEND_ACC_INTERFACE)) { > + if ((fe->common.fn_flags & (ZEND_ACC_CTOR | ZEND_ACC_STATIC)) && !(proto->common.scope->ce_flags & ZEND_ACC_INTERFACE)) { > return 1; > } > > /* check number of arguments */ > - if (proto->common.required_num_args != fe->common.required_num_args > - || proto->common.num_args > fe->common.num_args) { > + if (proto->common.num_args > fe->common.num_args) { > return 0; > } > > > - -- Jasper Bryant-Greene Director Album Limited jasper@album.co.nz +64 21 708 334 / 0800 425 286 http://www.album.co.nz/ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5-ecc0.1.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iFcDBQFFEfIqnqZ4vwo6v1gRCrP0AP4iqczaBXNYGTtooXvP8AKcfwS1tlfHghVa U4EWSFsIMQD/eoAnLN9JeJaqFqIqfttF2Pq4TR1GLHkJdowFKZY7vgc= =DSys -----END PGP SIGNATURE-----