Hello Andi,
Wednesday, February 4, 2004, 10:29:29 PM, you wrote:
> andi Wed Feb 4 16:29:29 2004 EDT
> Modified files:
> /php-src NEWS
> Log:
> - Added recent stuff to NEWS
> http://cvs.php.net/diff.php/php-src/NEWS?r1=1.1595&r2=1.1596&ty=u
> Index: php-src/NEWS
> diff -u php-src/NEWS:1.1595 php-src/NEWS:1.1596
> --- php-src/NEWS:1.1595 Tue Feb 3 01:44:45 2004
> +++ php-src/NEWS Wed Feb 4 16:29:28 2004
> @@ -1,6 +1,20 @@
> PHP NEWS
>
[...]
> +- Added support for an interface to extend another interface (Zeev)
He didn't fix anything here. The point was to disallow interface
implemnts but we still need to allow multiple base inetrfaces.
Here is the patch to fix it:
If you don't object i will commit.
--
Best regards,
Marcus mailto:[EMAIL PROTECTED]
Index: tests/classes/interface_doubled.phpt
===================================================================
RCS file: /repository/php-src/tests/classes/interface_doubled.phpt,v
retrieving revision 1.6
diff -u -p -d -r1.6 interface_doubled.phpt
--- tests/classes/interface_doubled.phpt 21 Jan 2004 22:36:49 -0000 1.6
+++ tests/classes/interface_doubled.phpt 4 Feb 2004 21:59:14 -0000
@@ -25,7 +25,7 @@ interface if_e {
abstract function f_d();
}
-interface if_f extends if_e, if_a, if_b, if_c, if_d, if_e {
+interface if_f extends /*if_e,*/ if_a, if_b, if_c, if_d /*, if_e*/ {
}
class base {
@@ -154,6 +154,7 @@ echo $t->test('if_d');
echo $t->test('if_e');
?>
+===DONE===
--EXPECTF--
class_a
is_a(class_a, if_a) yes
@@ -196,4 +197,5 @@ is_a(class_g, if_a) yes
is_a(class_g, if_b) yes
is_a(class_g, if_c) yes
is_a(class_g, if_d) yes
-is_a(class_g, if_e) yes
\ No newline at end of file
+is_a(class_g, if_e) no
+===DONE===
Index: Zend/zend_compile.c
===================================================================
RCS file: /repository/ZendEngine2/zend_compile.c,v
retrieving revision 1.536
diff -u -p -d -r1.536 zend_compile.c
--- Zend/zend_compile.c 4 Feb 2004 18:24:44 -0000 1.536
+++ Zend/zend_compile.c 4 Feb 2004 21:59:15 -0000
@@ -2456,7 +2456,7 @@ void zend_do_begin_class_declaration(zno
new_class_entry->line_start = zend_get_compiled_lineno(TSRMLS_C);
new_class_entry->ce_flags |= class_token->u.constant.value.lval;
- if (parent_class_name->op_type != IS_UNUSED) {
+ if (parent_class_name && parent_class_name->op_type != IS_UNUSED) {
doing_inheritance = 1;
}
@@ -2546,10 +2546,6 @@ void zend_do_implements_interface(znode
{
zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
- if (CG(active_class_entry)->ce_flags & ZEND_ACC_INTERFACE) {
- zend_error(E_COMPILE_ERROR, "Interfaces cannot implement other
classes/interfaces");
- }
-
opline->opcode = ZEND_ADD_INTERFACE;
opline->op1 = CG(implementing_class);
opline->op2 = *interface_znode;
Index: Zend/zend_language_parser.y
===================================================================
RCS file: /repository/ZendEngine2/zend_language_parser.y,v
retrieving revision 1.137
diff -u -p -d -r1.137 zend_language_parser.y
--- Zend/zend_language_parser.y 4 Feb 2004 16:30:15 -0000 1.137
+++ Zend/zend_language_parser.y 4 Feb 2004 21:59:16 -0000
@@ -274,6 +274,12 @@ unticked_class_declaration_statement:
'{'
class_statement_list
'}' { zend_do_end_class_declaration(&$1, &$2 TSRMLS_CC); }
+ | interface_entry T_STRING
+ { zend_do_begin_class_declaration(&$1, &$2, NULL TSRMLS_CC); }
+ interface_extends_list
+ '{'
+ class_statement_list
+ '}' { zend_do_end_class_declaration(&$1, &$2 TSRMLS_CC); }
;
@@ -281,7 +287,6 @@ class_entry_type:
T_CLASS { $$.u.constant.value.lval = 0; }
| T_ABSTRACT T_CLASS { $$.u.constant.value.lval =
ZEND_ACC_ABSTRACT_CLASS; }
| T_FINAL T_CLASS { $$.u.constant.value.lval = ZEND_ACC_FINAL_CLASS; }
- | T_INTERFACE { $$.u.constant.value.lval =
ZEND_ACC_INTERFACE; }
;
extends_from:
@@ -289,6 +294,15 @@ extends_from:
| T_EXTENDS fully_qualified_class_name { $$ = $2; }
;
+interface_entry:
+ T_INTERFACE { $$.u.constant.value.lval = ZEND_ACC_INTERFACE; }
+;
+
+interface_extends_list:
+ /* empty */
+ | T_EXTENDS interface_list
+;
+
implements_list:
/* empty */
| T_IMPLEMENTS interface_list
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php