com php-src: Fixed bug #71871: NEWS Zend/tests/bug71871.phpt Zend/tests/bug71871_2.phpt Zend/zend_compil e.c
| From: | Nikita Popov | Date: | Mon, 21 Mar 2016 21:49:18 +0000 |
| Subject: | com php-src: Fixed bug #71871: NEWS Zend/tests/bug71871.phpt Zend/tests/bug71871_2.phpt Zend/zend_compil e.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-91455@lists.php.net to get a copy of this message | ||
Commit: dc842bbf8d8c8e4c244bfae6dd23e3d461b4cbc9
Author: Nikita Popov <nikic@php.net> Mon, 21 Mar 2016 22:49:18 +0100
Parents: e988239634fa8c9e01373458d84ef84f1f69a223
Branches: PHP-7.0 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=dc842bbf8d8c8e4c244bfae6dd23e3d461b4cbc9
Log:
Fixed bug #71871
Bugs:
https://bugs.php.net/71871
Changed paths:
M NEWS
A Zend/tests/bug71871.phpt
A Zend/tests/bug71871_2.phpt
M Zend/zend_compile.c
Diff:
diff --git a/NEWS b/NEWS
index cc3bd0f..8f32f46 100644
--- a/NEWS
+++ b/NEWS
@@ -14,6 +14,7 @@ PHP NEWS
. Fixed bug #69659 (ArrayAccess, isset() and the offsetExists method).
(Nikita)
. Fixed bug #62059 (ArrayObject and isset are not friends). (Nikita)
+ . Fixed bug #71871 (Interfaces allow final and abstract functions). (Nikita)
- Curl:
. Fixed bug #71831 (CURLOPT_NOPROXY applied as long instead of string).
diff --git a/Zend/tests/bug71871.phpt b/Zend/tests/bug71871..phpt
new file mode 100644
index 0000000..1781ff0
--- /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 0000000..6a9404e
--- /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 7c72ced..24fffc9 100644
--- a/Zend/zend_compile..c
+++ b/Zend/zend_compile.c
@@ -4649,7 +4649,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));
}