diff options
-rw-r--r-- | Zend/tests/bug71871.phpt | 12 | ||||
-rw-r--r-- | Zend/tests/bug71871_2.phpt | 12 | ||||
-rw-r--r-- | Zend/zend_compile.c | 2 |
3 files changed, 25 insertions, 1 deletions
diff --git a/Zend/tests/bug71871.phpt b/Zend/tests/bug71871.phpt new file mode 100644 index 0000000000..1781ff07aa --- /dev/null +++ b/Zend/tests/bug71871.phpt @@ -0,0 +1,12 @@ +--TEST-- +Bug #71871: Interfaces allow final and abstract functions +--FILE-- +<?php + +interface test { + final function test(); +} + +?> +--EXPECTF-- +Fatal error: Access type for interface method test::test() must be omitted in %s on line %d diff --git a/Zend/tests/bug71871_2.phpt b/Zend/tests/bug71871_2.phpt new file mode 100644 index 0000000000..6a9404ea37 --- /dev/null +++ b/Zend/tests/bug71871_2.phpt @@ -0,0 +1,12 @@ +--TEST-- +Bug #71871: Interfaces allow final and abstract functions +--FILE-- +<?php + +interface test { + abstract function test(); +} + +?> +--EXPECTF-- +Fatal error: Access type for interface method test::test() must be omitted in %s on line %d diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 269864f47b..a8ccc2602c 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -5049,7 +5049,7 @@ void zend_begin_method_decl(zend_op_array *op_array, zend_string *name, zend_boo zend_string *lcname; if (in_interface) { - if ((op_array->fn_flags & ZEND_ACC_PPP_MASK) != ZEND_ACC_PUBLIC) { + if (!is_public || (op_array->fn_flags & (ZEND_ACC_FINAL|ZEND_ACC_ABSTRACT))) { zend_error_noreturn(E_COMPILE_ERROR, "Access type for interface method " "%s::%s() must be omitted", ZSTR_VAL(ce->name), ZSTR_VAL(name)); } |