mirror of
https://github.com/php/php-src.git
synced 2024-11-24 18:34:21 +08:00
Fixed Bug #69467 (Wrong checked for the interface by using Trait)
This commit is contained in:
parent
35baf71466
commit
c667c26f61
2
NEWS
2
NEWS
@ -3,6 +3,8 @@ PHP NEWS
|
||||
?? ??? 2015, PHP 5.5.25
|
||||
|
||||
- Core:
|
||||
. Fixed bug #69467 (Wrong checked for the interface by using Trait).
|
||||
(Laruence)
|
||||
. Fixed bug #69420 (Invalid read in zend_std_get_method). (Laruence)
|
||||
. Fixed bug #60022 ("use statement [...] has no effect" depends on leading
|
||||
backslash). (Nikita)
|
||||
|
21
Zend/tests/bug69467.phpt
Normal file
21
Zend/tests/bug69467.phpt
Normal file
@ -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
|
@ -3912,7 +3912,8 @@ 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(E_COMPILE_ERROR, "Declaration of %s must be compatible with %s",
|
||||
|
Loading…
Reference in New Issue
Block a user