diff options
author | Xinchen Hui <laruence@php.net> | 2015-04-21 22:37:00 +0800 |
---|---|---|
committer | Xinchen Hui <laruence@php.net> | 2015-04-21 22:37:00 +0800 |
commit | 9d9ba493a2352c57f225ca96dec3c9b56a3b98c5 (patch) | |
tree | 50951f43f6d515311215e9875a18065404898154 | |
parent | 160bf9c072f8db59c8412cfee9fa45faa1d7138e (diff) | |
parent | c667c26f616f91db5b890d39807c77c4720ba507 (diff) | |
download | php-git-9d9ba493a2352c57f225ca96dec3c9b56a3b98c5.tar.gz |
Merge branch 'PHP-5.5' into PHP-5.6
-rw-r--r-- | Zend/tests/bug69467.phpt | 21 | ||||
-rw-r--r-- | Zend/zend_compile.c | 5 |
2 files changed, 24 insertions, 2 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_compile.c b/Zend/zend_compile.c index 8f127d4193..82cfb33124 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -4051,14 +4051,15 @@ static void zend_add_trait_method(zend_class_entry *ce, const char *name, const } zend_hash_quick_update(*overriden, arKey, nKeyLength, h, fn, sizeof(zend_function), (void**)&fn); 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 (!zend_traits_method_compatibility_check(fn, existing_fn TSRMLS_CC)) { zend_error_noreturn(E_COMPILE_ERROR, "Declaration of %s must be compatible with %s", zend_get_function_declaration(fn TSRMLS_CC), zend_get_function_declaration(existing_fn TSRMLS_CC)); } - } else if (fn->common.fn_flags & ZEND_ACC_ABSTRACT) { + } else if (fn->common.fn_flags & ZEND_ACC_ABSTRACT) { /* Make sure the abstract declaration is compatible with previous declaration */ if (!zend_traits_method_compatibility_check(existing_fn, fn TSRMLS_CC)) { zend_error_noreturn(E_COMPILE_ERROR, "Declaration of %s must be compatible with %s", |