Merge branch 'PHP-7.0'

This commit is contained in:
Xinchen Hui 2015-11-23 18:33:21 +08:00
commit 42252f409b
3 changed files with 28 additions and 4 deletions

View File

@ -13,10 +13,10 @@ trait T {
}
}
class Bar extends Foo
class B 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
Warning: Declaration of T::bar() should be compatible with Foo::bar($a = 'Foo') in %sbug70957.php on line %d

21
Zend/tests/bug70958.phpt Normal file
View File

@ -0,0 +1,21 @@
--TEST--
Bug #70958 (Invalid opcode while using ::class as trait method paramater default value)
--FILE--
<?php
trait Foo
{
function bar($a = self::class) {
var_dump($a);
}
}
class B {
use Foo;
}
$b = new B;
$b->bar();
?>
--EXPECT--
string(1) "B"

View File

@ -7665,10 +7665,13 @@ void zend_eval_const_expr(zend_ast **ast_ptr) /* {{{ */
if (zend_try_compile_const_expr_resolve_class_name(&result, class_ast, name_ast, 0)) {
if (Z_TYPE(result) == IS_NULL) {
if (zend_get_class_fetch_type(zend_ast_get_str(class_ast)) == ZEND_FETCH_CLASS_SELF) {
zend_ast_destroy(ast);
*ast_ptr = zend_ast_create_ex(ZEND_AST_MAGIC_CONST, T_CLASS_C);
}
return;
} else {
break;
}
break;
}
zend_eval_const_expr(&class_ast);