summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXinchen Hui <laruence@php.net>2015-04-21 22:39:46 +0800
committerXinchen Hui <laruence@php.net>2015-04-21 22:39:46 +0800
commita090977419e30d5cbd06a2fde783820771f7b892 (patch)
tree6589e9dc0eea1d8cb8faae3b5e30425f2fdec520
parente121ccaaaddcb6c49d77c49c2fe6e7c6c6ade2ab (diff)
parentceb992501be4cc18c22f652a23c28cea683afe00 (diff)
downloadphp-git-a090977419e30d5cbd06a2fde783820771f7b892.tar.gz
Merge branch 'PHP-5.6'
Conflicts: Zend/zend_compile.c
-rw-r--r--Zend/tests/bug69467.phpt21
-rw-r--r--Zend/zend_inheritance.c3
2 files changed, 23 insertions, 1 deletions
diff --git a/Zend/tests/bug69467.phpt b/Zend/tests/bug69467.phpt
new file mode 100644
index 0000000000..22283003df
--- /dev/null
+++ b/Zend/tests/bug69467.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Bug #69467 (Wrong checked for the interface by using Trait)
+--FILE--
+<?php
+interface Baz {
+ public function bad();
+}
+
+trait Bar{
+ protected function bad(){}
+}
+
+class Foo implements Baz{
+ use Bar;
+}
+
+$test = new Foo();
+var_dump($test instanceof Baz);
+?>
+--EXPECTF--
+Fatal error: Access level to Bar::bad() must be public (as in class Baz) in %sbug69467.php on line %d
diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c
index 4f31529a85..5a6a66c345 100644
--- a/Zend/zend_inheritance.c
+++ b/Zend/zend_inheritance.c
@@ -1078,7 +1078,8 @@ static void zend_add_trait_method(zend_class_entry *ce, const char *name, zend_s
}
zend_hash_update_mem(*overriden, key, fn, sizeof(zend_function));
return;
- } else if (existing_fn->common.fn_flags & ZEND_ACC_ABSTRACT) {
+ } else if (existing_fn->common.fn_flags & ZEND_ACC_ABSTRACT &&
+ (existing_fn->common.scope->ce_flags & ZEND_ACC_INTERFACE) == 0) {
/* Make sure the trait method is compatible with previosly declared abstract method */
if (UNEXPECTED(!zend_traits_method_compatibility_check(fn, existing_fn))) {
zend_error_noreturn(E_COMPILE_ERROR, "Declaration of %s must be compatible with %s",