diff options
author | Felipe Pena <felipe@php.net> | 2011-11-19 13:36:03 +0000 |
---|---|---|
committer | Felipe Pena <felipe@php.net> | 2011-11-19 13:36:03 +0000 |
commit | 31ef559712dae57046b6377f07634ad57f9d88cf (patch) | |
tree | ec87d25c6325adfe65004d6cb0af18fd6be5f1be | |
parent | 75adcc8db02e9aed9b9e4a06a350db05c259026c (diff) | |
download | php-git-31ef559712dae57046b6377f07634ad57f9d88cf.tar.gz |
- Fixed bug #43200 (Interface implementation / inheritence not possible in abstract classes)
-rw-r--r-- | NEWS | 4 | ||||
-rw-r--r-- | Zend/tests/bug43200.phpt | 51 | ||||
-rw-r--r-- | Zend/tests/bug43200_2.phpt | 25 | ||||
-rw-r--r-- | Zend/zend_compile.c | 3 |
4 files changed, 82 insertions, 1 deletions
@@ -10,6 +10,10 @@ PHP NEWS (klightspeed at netspace dot net dot au) . Fixed bug #52624 (tempnam() by-pass open_basedir with nonnexistent directory). (Felipe) + +- Zend Engine: + . Fixed bug #43200 (Interface implementation / inheritence not possible in + abstract classes). (Felipe) - PHP-FPM SAPI: . Fixed bug #60179 (php_flag and php_value does not work properly). (fat) 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-- +<?php + +interface a { + function foo(); + function bar(); +} +interface b { + function foo(); +} + +abstract class c { + function bar() { } +} + +class x extends c implements a, b { + function foo() { } +} + +ReflectionClass::export('x'); + +?> +--EXPECTF-- +Class [ <user> class x extends c implements a, b ] { + @@ %s 15-17 + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [2] { + Method [ <user, prototype b> public method foo ] { + @@ %s 16 - 16 + } + + Method [ <user, inherits c, prototype a> 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-- +<?php + +interface A { + function foo(); +} + +abstract class B implements A { + abstract public function foo(); +} + +class C extends B { + public function foo() { + echo 'works'; + } +} + +$o = new C(); +$o->foo(); + +?> +--EXPECTF-- +works diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 1248715f12..0b881098cf 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -2628,7 +2628,8 @@ static zend_bool do_inherit_method_check(HashTable *child_function_table, zend_f return 1; /* method doesn't exist in child, copy from parent */ } - 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)", |