mirror of
https://github.com/php/php-src.git
synced 2024-09-21 18:07:23 +00:00
Fixed bug #70957 (self::class can not be resolved with reflection for abstract class)
This commit is contained in:
parent
205e0ba81d
commit
ab17840d33
2
NEWS
2
NEWS
@ -3,6 +3,8 @@ PHP NEWS
|
||||
?? ??? 2015, PHP 5.6.17
|
||||
|
||||
- Core:
|
||||
. Fixed bug #70957 (self::class can not be resolved with reflection for
|
||||
abstract class). (Laruence)
|
||||
. Fixed bug #70944 (try{ } finally{} can create infinite chains of
|
||||
exceptions). (Laruence)
|
||||
|
||||
|
22
Zend/tests/bug70957.phpt
Normal file
22
Zend/tests/bug70957.phpt
Normal file
@ -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
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user