Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:48977 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 14132 invoked from network); 28 Jun 2010 09:06:00 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Jun 2010 09:06:00 -0000 Authentication-Results: pb1.pair.com header.from=pierre.php@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=pierre.php@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.161.42 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: pierre.php@gmail.com X-Host-Fingerprint: 209.85.161.42 mail-fx0-f42.google.com Received: from [209.85.161.42] ([209.85.161.42:58553] helo=mail-fx0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 17/21-06774-6F5682C4 for ; Mon, 28 Jun 2010 05:05:58 -0400 Received: by fxm4 with SMTP id 4so3469409fxm.29 for ; Mon, 28 Jun 2010 02:05:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:cc:content-type:content-transfer-encoding; bh=jm+nz5luerDSTB7dPzKSxkdsQ56l3o0n6UKA7RQLuDU=; b=QdKTQEg8A1IUX1n4/mQQ9l7+4XmUpM83YuDJKdCl6pQikdMewv5djF0A8rP+ysK4Ec rp25sjXq4fK13fRYeW0Fjb2AIR1cTq2MaFXngehwMbeTb9wqsmX5YwCdDJEDy6ul7RUf X4m8PXpKY40LuoCUKoL8MbENqmEi1QGirP9lA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=OFmk1oKRUaUMp/0DyxPlEBTlza3y2aMLjG99G/Q/9tZa9uINjkZv4RRgoWFBJ55S+R eOYbpcVR4sVpYLl9wbDiQmK/6eBIYVskTcoAMJst52UwPh4mvOLxDvz/whubsJr77uin zYo8jKkALFvVYl2p0wUeluoyuWoEVGPM5BFm4= MIME-Version: 1.0 Received: by 10.223.68.131 with SMTP id v3mr3554804fai.82.1277715955229; Mon, 28 Jun 2010 02:05:55 -0700 (PDT) Received: by 10.223.113.143 with HTTP; Mon, 28 Jun 2010 02:05:55 -0700 (PDT) Date: Mon, 28 Jun 2010 11:05:55 +0200 Message-ID: To: =?ISO-8859-1?Q?Johannes_Schl=FCter?= Cc: Felipe Pena , PHP internals list Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_2/Zend/tests/bug51421.phpt branches/PHP_5_2/Zend/zend_compile.c branches/PHP_5_3/Zend/tests/bug51421.phpt branches/PHP_5_3/Zend/zend_compile.c trunk/Zend/tests/bug51421.phpt trunk/Zend/zen From: pierre.php@gmail.com (Pierre Joye) hi, Did we not discuss this problem recently? If I'm not mistaken the decision was to do not change the way constructors work in 5.x. Cheers, 2010/6/28 Johannes Schl=FCter : > Hi, > > On Sat, 2010-06-26 at 22:05 +0000, Felipe Pena wrote: >> felipe =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 Sat, 26 Jun 2010 22:05:13 +0000 >> >> Revision: http://svn.php.net/viewvc?view=3Drevision&revision=3D300770 >> >> Log: >> - Fixed bug #51421 (Abstract __construct constructor argument list not e= nforced) >> >> Bug: http://bugs.php.net/51421 (Closed) Abstract __construct constructor= argument list not enforced > > Won't this break compatibility? > > I'd say the change is logically correct but not sure we should break BC > there during RC. > > johannes > >> Changed paths: >> =A0 =A0 A =A0 php/php-src/branches/PHP_5_2/Zend/tests/bug51421.phpt >> =A0 =A0 U =A0 php/php-src/branches/PHP_5_2/Zend/zend_compile.c >> =A0 =A0 A =A0 php/php-src/branches/PHP_5_3/Zend/tests/bug51421.phpt >> =A0 =A0 U =A0 php/php-src/branches/PHP_5_3/Zend/zend_compile.c >> =A0 =A0 A =A0 php/php-src/trunk/Zend/tests/bug51421.phpt >> =A0 =A0 U =A0 php/php-src/trunk/Zend/zend_compile.c >> >> Added: php/php-src/branches/PHP_5_2/Zend/tests/bug51421.phpt >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> --- php/php-src/branches/PHP_5_2/Zend/tests/bug51421.phpt =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (rev 0) >> +++ php/php-src/branches/PHP_5_2/Zend/tests/bug51421.phpt =A0 =A0 2010-0= 6-26 22:05:13 UTC (rev 300770) >> @@ -0,0 +1,18 @@ >> +--TEST-- >> +Bug #51421 (Abstract __construct constructor argument list not enforced= ) >> +--FILE-- >> +> + >> +class ExampleClass {} >> + >> +abstract class TestInterface { >> + =A0 =A0 abstract public function __construct(ExampleClass $var); >> +} >> + >> +class Test extends TestInterface { >> + =A0 =A0 public function __construct() {} >> +} >> + >> +?> >> +--EXPECTF-- >> +Fatal error: Declaration of Test::__construct() must be compatible with= that of TestInterface::__construct() in %s on line %d >> >> >> Property changes on: php/php-src/branches/PHP_5_2/Zend/tests/bug51421.ph= pt >> ___________________________________________________________________ >> Added: svn:keywords >> =A0 =A0+ Id Rev Revision >> Added: svn:eol-style >> =A0 =A0+ native >> >> Modified: php/php-src/branches/PHP_5_2/Zend/zend_compile.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> --- php/php-src/branches/PHP_5_2/Zend/zend_compile.c =A02010-06-26 21:29= :56 UTC (rev 300769) >> +++ php/php-src/branches/PHP_5_2/Zend/zend_compile.c =A02010-06-26 22:05= :13 UTC (rev 300770) >> @@ -2009,13 +2009,20 @@ >> =A0{ >> =A0 =A0 =A0 zend_uint i; >> >> - =A0 =A0 /* If it's a user function then arg_info =3D=3D NULL means we = don't have any parameters but we still need to do the arg number checks. = =A0We are only willing to ignore this for internal functions because extens= ions don't always define arg_info. */ >> + =A0 =A0 /* If it's a user function then arg_info =3D=3D NULL means we = don't have any parameters but >> + =A0 =A0 =A0* we still need to do the arg number checks. =A0We are only= willing to ignore this for internal >> + =A0 =A0 =A0* functions because extensions don't always define arg_info= . >> + =A0 =A0 =A0*/ >> =A0 =A0 =A0 if (!proto || (!proto->common.arg_info && proto->common.type= !=3D ZEND_USER_FUNCTION)) { >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 return 1; >> =A0 =A0 =A0 } >> >> - =A0 =A0 /* Checks for constructors only if they are declared in an int= erface */ >> - =A0 =A0 if ((fe->common.fn_flags & ZEND_ACC_CTOR) && !(proto->common.s= cope->ce_flags & ZEND_ACC_INTERFACE)) { >> + =A0 =A0 /* Checks for constructors only if they are declared in an int= erface, >> + =A0 =A0 =A0* or explicitly marked as abstract >> + =A0 =A0 =A0*/ >> + =A0 =A0 if ((fe->common.fn_flags & ZEND_ACC_CTOR) >> + =A0 =A0 =A0 =A0 =A0 =A0 && ((proto->common.scope->ce_flags & ZEND_ACC_= INTERFACE) =3D=3D 0 >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 && (proto->common.fn_flags & Z= END_ACC_ABSTRACT) =3D=3D 0)) { >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 return 1; >> =A0 =A0 =A0 } >> >> >> Added: php/php-src/branches/PHP_5_3/Zend/tests/bug51421.phpt >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> --- php/php-src/branches/PHP_5_3/Zend/tests/bug51421.phpt =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (rev 0) >> +++ php/php-src/branches/PHP_5_3/Zend/tests/bug51421.phpt =A0 =A0 2010-0= 6-26 22:05:13 UTC (rev 300770) >> @@ -0,0 +1,18 @@ >> +--TEST-- >> +Bug #51421 (Abstract __construct constructor argument list not enforced= ) >> +--FILE-- >> +> + >> +class ExampleClass {} >> + >> +abstract class TestInterface { >> + =A0 =A0 abstract public function __construct(ExampleClass $var); >> +} >> + >> +class Test extends TestInterface { >> + =A0 =A0 public function __construct() {} >> +} >> + >> +?> >> +--EXPECTF-- >> +Fatal error: Declaration of Test::__construct() must be compatible with= that of TestInterface::__construct() in %s on line %d >> >> >> Property changes on: php/php-src/branches/PHP_5_3/Zend/tests/bug51421.ph= pt >> ___________________________________________________________________ >> Added: svn:keywords >> =A0 =A0+ Id Rev Revision >> Added: svn:eol-style >> =A0 =A0+ native >> >> Modified: php/php-src/branches/PHP_5_3/Zend/zend_compile.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> --- php/php-src/branches/PHP_5_3/Zend/zend_compile.c =A02010-06-26 21:29= :56 UTC (rev 300769) >> +++ php/php-src/branches/PHP_5_3/Zend/zend_compile.c =A02010-06-26 22:05= :13 UTC (rev 300770) >> @@ -2532,13 +2532,20 @@ >> =A0{ >> =A0 =A0 =A0 zend_uint i; >> >> - =A0 =A0 /* If it's a user function then arg_info =3D=3D NULL means we = don't have any parameters but we still need to do the arg number checks. = =A0We are only willing to ignore this for internal functions because extens= ions don't always define arg_info. */ >> + =A0 =A0 /* If it's a user function then arg_info =3D=3D NULL means we = don't have any parameters but >> + =A0 =A0 =A0* we still need to do the arg number checks. =A0We are only= willing to ignore this for internal >> + =A0 =A0 =A0* functions because extensions don't always define arg_info= . >> + =A0 =A0 =A0*/ >> =A0 =A0 =A0 if (!proto || (!proto->common.arg_info && proto->common.type= !=3D ZEND_USER_FUNCTION)) { >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 return 1; >> =A0 =A0 =A0 } >> >> - =A0 =A0 /* Checks for constructors only if they are declared in an int= erface */ >> - =A0 =A0 if ((fe->common.fn_flags & ZEND_ACC_CTOR) && !(proto->common.s= cope->ce_flags & ZEND_ACC_INTERFACE)) { >> + =A0 =A0 /* Checks for constructors only if they are declared in an int= erface, >> + =A0 =A0 =A0* or explicitly marked as abstract >> + =A0 =A0 =A0*/ >> + =A0 =A0 if ((fe->common.fn_flags & ZEND_ACC_CTOR) >> + =A0 =A0 =A0 =A0 =A0 =A0 && ((proto->common.scope->ce_flags & ZEND_ACC_= INTERFACE) =3D=3D 0 >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 && (proto->common.fn_flags & Z= END_ACC_ABSTRACT) =3D=3D 0)) { >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 return 1; >> =A0 =A0 =A0 } >> >> >> Added: php/php-src/trunk/Zend/tests/bug51421.phpt >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> --- php/php-src/trunk/Zend/tests/bug51421.phpt =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(rev 0) >> +++ php/php-src/trunk/Zend/tests/bug51421.phpt =A0 =A0 =A0 =A02010-06-26= 22:05:13 UTC (rev 300770) >> @@ -0,0 +1,18 @@ >> +--TEST-- >> +Bug #51421 (Abstract __construct constructor argument list not enforced= ) >> +--FILE-- >> +> + >> +class ExampleClass {} >> + >> +abstract class TestInterface { >> + =A0 =A0 abstract public function __construct(ExampleClass $var); >> +} >> + >> +class Test extends TestInterface { >> + =A0 =A0 public function __construct() {} >> +} >> + >> +?> >> +--EXPECTF-- >> +Fatal error: Declaration of Test::__construct() must be compatible with= that of TestInterface::__construct() in %s on line %d >> >> >> Property changes on: php/php-src/trunk/Zend/tests/bug51421.phpt >> ___________________________________________________________________ >> Added: svn:keywords >> =A0 =A0+ Id Rev Revision >> Added: svn:eol-style >> =A0 =A0+ native >> >> Modified: php/php-src/trunk/Zend/zend_compile.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> --- php/php-src/trunk/Zend/zend_compile.c =A0 =A0 2010-06-26 21:29:56 UT= C (rev 300769) >> +++ php/php-src/trunk/Zend/zend_compile.c =A0 =A0 2010-06-26 22:05:13 UT= C (rev 300770) >> @@ -2909,13 +2909,20 @@ >> =A0{ >> =A0 =A0 =A0 zend_uint i; >> >> - =A0 =A0 /* If it's a user function then arg_info =3D=3D NULL means we = don't have any parameters but we still need to do the arg number checks. = =A0We are only willing to ignore this for internal functions because extens= ions don't always define arg_info. */ >> + =A0 =A0 /* If it's a user function then arg_info =3D=3D NULL means we = don't have any parameters but >> + =A0 =A0 =A0* we still need to do the arg number checks. =A0We are only= willing to ignore this for internal >> + =A0 =A0 =A0* functions because extensions don't always define arg_info= . >> + =A0 =A0 =A0*/ >> =A0 =A0 =A0 if (!proto || (!proto->common.arg_info && proto->common.type= !=3D ZEND_USER_FUNCTION)) { >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 return 1; >> =A0 =A0 =A0 } >> >> - =A0 =A0 /* Checks for constructors only if they are declared in an int= erface */ >> - =A0 =A0 if ((fe->common.fn_flags & ZEND_ACC_CTOR) && !(proto->common.s= cope->ce_flags & ZEND_ACC_INTERFACE)) { >> + =A0 =A0 /* Checks for constructors only if they are declared in an int= erface, >> + =A0 =A0 =A0* or explicitly marked as abstract >> + =A0 =A0 =A0*/ >> + =A0 =A0 if ((fe->common.fn_flags & ZEND_ACC_CTOR) >> + =A0 =A0 =A0 =A0 =A0 =A0 && ((proto->common.scope->ce_flags & ZEND_ACC_= INTERFACE) =3D=3D 0 >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 && (proto->common.fn_flags & Z= END_ACC_ABSTRACT) =3D=3D 0)) { >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 return 1; >> =A0 =A0 =A0 } >> >> >> -- >> PHP CVS Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php > > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --=20 Pierre @pierrejoye | http://blog.thepimp.net | http://www.libgd.org