cvs: ZendEngine2(PHP_5_2) / zend_compile.c php-src/tests/classes ctor_in_interface_01.phpt ctor_in_interface_02.phpt ctor_in_interface_03.phpt
ctor_in_interface_04.phpt

From: Date: Wed, 10 May 2006 01:23:55 +0000
Subject: cvs: ZendEngine2(PHP_5_2) / zend_compile.c php-src/tests/classes ctor_in_interface_01.phpt ctor_in_interface_02.phpt ctor_in_interface_03.phpt
ctor_in_interface_04.phpt
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-4845@lists.php.net to get a copy of this message
helly Wed May 10 01:23:55 2006 UTC Added files: (Branch: PHP_5_2) /php-src/tests/classes ctor_in_interface_01.phpt ctor_in_interface_02.phpt ctor_in_interface_03.phpt ctor_in_interface_04.phpt Modified files: /ZendEngine2 zend_compile.c Log: - MFH Constructors in interfaces http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_compile.c?r1=1.647.2.27.2.1&r2=1.647.2.27.2.2&diff_format=u Index: ZendEngine2/zend_compile.c diff -u ZendEngine2/zend_compile.c:1.647.2.27.2.1 ZendEngine2/zend_compile.c:1.647.2.27.2.2 --- ZendEngine2/zend_compile.c:1.647.2.27.2.1 Tue May 9 23:53:23 2006 +++ ZendEngine2/zend_compile.c Wed May 10 01:23:55 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_compile.c,v 1.647.2.27.2.1 2006/05/09 23:53:23 helly Exp $ */ +/* $Id: zend_compile.c,v 1.647.2.27.2.2 2006/05/10 01:23:55 helly Exp $ */ #include <zend_language_parser.h> #include "zend.h" @@ -1920,8 +1920,8 @@ return 1; } - /* No implementation checks for constructors */ - if (fe->common.fn_flags & ZEND_ACC_CTOR) { + /* 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)) { return 1; } http://cvs.php.net/viewcvs.cgi/php-src/tests/classes/ctor_in_interface_01.phpt?view=markup&rev=1.1 Index: php-src/tests/classes/ctor_in_interface_01.phpt +++ php-src/tests/classes/ctor_in_interface_01.phpt --TEST-- ZE2 A class constructor must keep the signature of an interface --FILE-- <?php interface constr { function __construct(); } class implem implements constr { function __construct($a) { } } ?> --EXPECTF-- Fatal error: Declaration of implem::__construct() must be compatible with that of constr::__construct() in %s on line %d http://cvs.php.net/viewcvs.cgi/php-src/tests/classes/ctor_in_interface_02.phpt?view=markup&rev=1.1 Index: php-src/tests/classes/ctor_in_interface_02.phpt +++ php-src/tests/classes/ctor_in_interface_02.phpt --TEST-- ZE2 A class constructor must keep the signature of all interfaces --FILE-- <?php interface constr1 { function __construct(); } interface constr2 extends constr1 { } class implem12 implements constr2 { function __construct() { } } interface constr3 { function __construct($a); } class implem13 implements constr1, constr3 { function __construct() { } } ?> --EXPECTF-- Fatal error: Can't inherit abstract function constr3::__construct() (previously declared abstract in constr1) in %s on line %d http://cvs.php.net/viewcvs.cgi/php-src/tests/classes/ctor_in_interface_03.phpt?view=markup&rev=1.1 Index: php-src/tests/classes/ctor_in_interface_03.phpt +++ php-src/tests/classes/ctor_in_interface_03.phpt --TEST-- ZE2 A class constructor must keep the signature of base class interfaces --FILE-- <?php interface constr { function __construct(); } abstract class implem implements constr { } class derived extends implem { function __construct($a) { } } ?> --EXPECTF-- Fatal error: Declaration of derived::__construct() must be compatible with that of constr::__construct() in %s on line %d http://cvs.php.net/viewcvs.cgi/php-src/tests/classes/ctor_in_interface_04.phpt?view=markup&rev=1.1 Index: php-src/tests/classes/ctor_in_interface_04.phpt +++ php-src/tests/classes/ctor_in_interface_04.phpt --TEST-- ZE2 A class constructor must keep the signature of base class interfaces --FILE-- <?php interface constr { function __construct(); } class implem implements constr { function __construct() { } } class derived extends implem { function __construct($a) { } } ?> --EXPECTF-- Fatal error: Declaration of derived::__construct() must be compatible with that of constr::__construct() in %s on line %d

« previous php.zend-engine.cvs (#4845) next »