summaryrefslogtreecommitdiff
path: root/Zend/zend_compile.c
diff options
context:
space:
mode:
authorekinhbayar <me@ekins.space>2019-01-28 09:46:29 +0300
committerNikita Popov <nikita.ppv@gmail.com>2019-01-28 09:22:18 +0100
commitef68cd324923d81565debef8939b015a3f4b8a6f (patch)
treed9bf55e0eb1b7f1967781e6b45a2b7877880e5e2 /Zend/zend_compile.c
parentdc2ffdeed7d5c17eeb4f706f530eccafb425f92a (diff)
downloadphp-git-ef68cd324923d81565debef8939b015a3f4b8a6f.tar.gz
Fixed bug #77530: PHP crashes when parsing "(2)::class"
Diffstat (limited to 'Zend/zend_compile.c')
-rw-r--r--Zend/zend_compile.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 28336130cc..46ca21a436 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -1494,6 +1494,7 @@ static void zend_ensure_valid_class_fetch_type(uint32_t fetch_type) /* {{{ */
static zend_bool zend_try_compile_const_expr_resolve_class_name(zval *zv, zend_ast *class_ast, zend_ast *name_ast, zend_bool constant) /* {{{ */
{
uint32_t fetch_type;
+ zval *class_name;
if (name_ast->kind != ZEND_AST_ZVAL) {
return 0;
@@ -1508,7 +1509,13 @@ static zend_bool zend_try_compile_const_expr_resolve_class_name(zval *zv, zend_a
"Dynamic class names are not allowed in compile-time ::class fetch");
}
- 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) {