diff options
author | Xinchen Hui <laruence@gmail.com> | 2015-11-23 12:20:44 +0800 |
---|---|---|
committer | Xinchen Hui <laruence@gmail.com> | 2015-11-23 12:20:44 +0800 |
commit | ab17840d33354cc32d24c88d3e401d7b0869c996 (patch) | |
tree | 2f30b40f683b7f6d4b505a3dc78d41be0d79c5e3 /Zend | |
parent | 205e0ba81d84bf91bdae13039a77db5fa1344dd4 (diff) | |
download | php-git-ab17840d33354cc32d24c88d3e401d7b0869c996.tar.gz |
Fixed bug #70957 (self::class can not be resolved with reflection for abstract class)
Diffstat (limited to 'Zend')
-rw-r--r-- | Zend/tests/bug70957.phpt | 22 | ||||
-rw-r--r-- | Zend/zend_compile.c | 2 |
2 files changed, 23 insertions, 1 deletions
diff --git a/Zend/tests/bug70957.phpt b/Zend/tests/bug70957.phpt new file mode 100644 index 0000000000..e6a38f7641 --- /dev/null +++ b/Zend/tests/bug70957.phpt @@ -0,0 +1,22 @@ +--TEST-- +Bug #70957 (self::class can not be resolved with reflection for abstract class) +--FILE-- +<?php + +abstract class Foo +{ + function bar($a = self::class) {} +} + +trait T { + public function bar() { + } +} + +class Bar extends Foo +{ + use T; +} +?> +--EXPECTF-- +Strict Standards: Declaration of T::bar() should be compatible with Foo::bar($a = 'Foo') in %sbug70957.php on line %d diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index fca4e2a04d..03c2f5a31e 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -2214,7 +2214,7 @@ void zend_do_resolve_class_name(znode *result, znode *class_name, int is_static if (!CG(active_class_entry)) { zend_error_noreturn(E_COMPILE_ERROR, "Cannot access self::class when no class scope is active"); } - if (CG(active_class_entry)->ce_flags & ZEND_ACC_TRAIT) { + if ((CG(active_class_entry)->ce_flags & ZEND_ACC_TRAIT) == ZEND_ACC_TRAIT) { constant_name.op_type = IS_CONST; ZVAL_STRINGL(&constant_name.u.constant, "class", sizeof("class")-1, 1); zend_do_fetch_constant(result, class_name, &constant_name, ZEND_RT, 1 TSRMLS_CC); |