From: Bob Weinand Date: Wed, 3 Jun 2015 21:59:59 +0000 (+0200) Subject: Fix Bug #69754 (Compile failure with ::class in array) X-Git-Tag: php-7.0.0alpha1~37 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1d3f77d13d2b457bdf1bc52045da4679741e65cb;p=php Fix Bug #69754 (Compile failure with ::class in array) --- diff --git a/Zend/tests/bug69754.phpt b/Zend/tests/bug69754.phpt new file mode 100644 index 0000000000..be55ae2b78 --- /dev/null +++ b/Zend/tests/bug69754.phpt @@ -0,0 +1,25 @@ +--TEST-- +Bug #69754 (Use of ::class inside array causes compile error) +--FILE-- +test(); + +?> +--EXPECTF-- +string(7) "Example" +string(16) "ExampleIsAwesome" +string(15) "Example%d" +array(1) { + [0]=> + string(7) "Example" +} diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index d1b57c413f..0853dde10b 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -7140,8 +7140,12 @@ void zend_eval_const_expr(zend_ast **ast_ptr) /* {{{ */ zend_ast *name_ast = ast->child[1]; zend_string *resolved_name; - if (zend_try_compile_const_expr_resolve_class_name(&result, class_ast, name_ast, 1)) { - break; + if (zend_try_compile_const_expr_resolve_class_name(&result, class_ast, name_ast, 0)) { + if (Z_TYPE(result) == IS_NULL) { + return; + } else { + break; + } } zend_eval_const_expr(&class_ast);