From: Nikita Popov Date: Mon, 28 Jan 2019 08:23:53 +0000 (+0100) Subject: Merge branch 'PHP-7.3' X-Git-Tag: php-7.4.0alpha1~1150 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=768bc7a0b8ee2a139111c8825e689a37f22ba0b7;p=php Merge branch 'PHP-7.3' --- 768bc7a0b8ee2a139111c8825e689a37f22ba0b7 diff --cc Zend/zend_compile.c index 6985e1bcaa,e22e3f8e37..01c90559db --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@@ -1331,15 -1477,31 +1331,22 @@@ static void zend_ensure_valid_class_fet } /* }}} */ -static zend_bool zend_try_compile_const_expr_resolve_class_name(zval *zv, zend_ast *class_ast, zend_ast *name_ast, zend_bool constant) /* {{{ */ +static zend_bool zend_try_compile_const_expr_resolve_class_name(zval *zv, zend_ast *class_ast) /* {{{ */ { uint32_t fetch_type; + zval *class_name; - if (name_ast->kind != ZEND_AST_ZVAL) { - return 0; - } - - if (!zend_string_equals_literal_ci(zend_ast_get_str(name_ast), "class")) { - return 0; - } - if (class_ast->kind != ZEND_AST_ZVAL) { - zend_error_noreturn(E_COMPILE_ERROR, - "Dynamic class names are not allowed in compile-time ::class fetch"); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot use ::class with dynamic class name"); } - fetch_type = zend_get_class_fetch_type(zend_ast_get_str(class_ast)); + class_name = zend_ast_get_zval(class_ast); + + if (Z_TYPE_P(class_name) != IS_STRING) { + zend_error_noreturn(E_COMPILE_ERROR, "Illegal class name"); + } + + fetch_type = zend_get_class_fetch_type(Z_STR_P(class_name)); zend_ensure_valid_class_fetch_type(fetch_type); switch (fetch_type) {