com php-src: Fix Bug #69754 (Compile failure with ::class in array): Zend/tests/bug69754.phpt Zend/zend_compile.c

From: Date: Wed, 03 Jun 2015 21:59:59 +0000
Subject: com php-src: Fix Bug #69754 (Compile failure with ::class in array): Zend/tests/bug69754.phpt Zend/zend_compile.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-87059@lists.php.net to get a copy of this message
Commit: 1d3f77d13d2b457bdf1bc52045da4679741e65cb Author: Bob Weinand <bobwei9@hotmail.com> Wed, 3 Jun 2015 23:59:59 +0200 Parents: 2fcdad6a58e0f4e1dd78fbc4f9dec4ea2c868088 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=1d3f77d13d2b457bdf1bc52045da4679741e65cb Log: Fix Bug #69754 (Compile failure with ::class in array) Bugs: https://bugs.php.net/69754 Changed paths: A Zend/tests/bug69754.phpt M Zend/zend_compile.c Diff: diff --git a/Zend/tests/bug69754.phpt b/Zend/tests/bug69754.phpt new file mode 100644 index 0000000..be55ae2 --- /dev/null +++ b/Zend/tests/bug69754.phpt @@ -0,0 +1,25 @@ +--TEST-- +Bug #69754 (Use of ::class inside array causes compile error) +--FILE-- +<?php + +class Example { + public function test() { + var_dump(static::class); + var_dump(static::class . 'IsAwesome'); + var_dump(static::class . date('Ymd')); + var_dump([static::class]); + } +} + +(new Example)->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 d1b57c4..0853dde 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);

« previous php.cvs (#87059) next »