From: Felipe Pena Date: Sat, 19 Nov 2011 13:36:03 +0000 (+0000) Subject: - Fixed bug #43200 (Interface implementation / inheritence not possible in abstract... X-Git-Tag: php-5.5.0alpha1~858 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=14b5e775b01ab22d9686a7ab2ce7b805f5818233;p=php - Fixed bug #43200 (Interface implementation / inheritence not possible in abstract classes) --- diff --git a/Zend/tests/bug43200.phpt b/Zend/tests/bug43200.phpt new file mode 100644 index 0000000000..24a8bbb1d7 --- /dev/null +++ b/Zend/tests/bug43200.phpt @@ -0,0 +1,51 @@ +--TEST-- +Bug #43200 (Interface implementation / inheritence not possible in abstract classes) +--FILE-- + +--EXPECTF-- +Class [ class x extends c implements a, b ] { + @@ %s 15-17 + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [2] { + Method [ public method foo ] { + @@ %s 16 - 16 + } + + Method [ public method bar ] { + @@ %s 12 - 12 + } + } +} + diff --git a/Zend/tests/bug43200_2.phpt b/Zend/tests/bug43200_2.phpt new file mode 100644 index 0000000000..5efc5facff --- /dev/null +++ b/Zend/tests/bug43200_2.phpt @@ -0,0 +1,25 @@ +--TEST-- +Bug #43200.2 (Interface implementation / inheritence not possible in abstract classes) +--FILE-- +foo(); + +?> +--EXPECTF-- +works diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index b1802f087e..40d2e93a97 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -3173,7 +3173,8 @@ static void do_inheritance_check_on_method(zend_function *child, zend_function * zend_uint child_flags; zend_uint parent_flags = parent->common.fn_flags; - if (parent->common.fn_flags & ZEND_ACC_ABSTRACT + if ((parent->common.scope->ce_flags & ZEND_ACC_INTERFACE) == 0 + && parent->common.fn_flags & ZEND_ACC_ABSTRACT && parent->common.scope != (child->common.prototype ? child->common.prototype->common.scope : child->common.scope) && child->common.fn_flags & (ZEND_ACC_ABSTRACT|ZEND_ACC_IMPLEMENTED_ABSTRACT)) { zend_error(E_COMPILE_ERROR, "Can't inherit abstract function %s::%s() (previously declared abstract in %s)",