From 51ccc88b877a7298d6bec355e3b42174485392cf Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Mon, 23 Nov 2015 18:31:56 +0800 Subject: [PATCH] Port fix to 7.0 --- NEWS | 2 ++ Zend/zend_compile.c | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index b3b2d5091a..8a0441d78c 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,8 @@ PHP NEWS ?? ??? 2015, PHP 7.0.1 - Core: + . Fixed bug #70958 (Invalid opcode while using ::class as trait method + paramater default value). (Laruence) . Fixed bug #70947 (INI parser segfault with INI_SCANNER_TYPED). (Laruence) . Fixed bug #70944 (try{ } finally{} can create infinite chains of exceptions). (Laruence) diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 75e484f1dd..b91fddeeb0 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -7472,10 +7472,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); -- 2.40.0