com php-src: Fixed bug #74546 (SIGILL in ZEND_FETCH_CLASS _CONSTANT_SPEC_CONST_CONST_HANDLER()): NEWS Zend/tests/bug74546.phpt Zend/zend_compile .c

[email protected] (Xinchen Hui)
Newsgroups php.cvs
Message-ID <[email protected]>
Commit:    87d56a3d07a337269be2e80b67766b4e94120dd8
Author:    Xinchen Hui <[email protected]>         Mon, 8 May 2017 11:32:08 +0800
Parents:   5c957b502e92ab32f44e449dd6ceed573cc65bf5
Branches:  PHP-7.0 PHP-7.1 master

Link:       http://git.php.net/?p=php-src.git;a=commitdiff;h=87d56a3d07a337269be2e80b67766b4e94120dd8

Log:
Fixed bug #74546 (SIGILL in ZEND_FETCH_CLASS_CONSTANT_SPEC_CONST_CONST_HANDLER())

Bugs:
https://bugs.php.net/74546

Changed paths:
  M  NEWS
  A  Zend/tests/bug74546.phpt
  M  Zend/zend_compile.c


Diff:
diff --git a/NEWS b/NEWS
index eddf0bc..12e2e8f 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,10 @@ PHP                                                                        NEWS
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? ??? 2017 PHP 7.0.20
 
+- Core:
+  . Fixed bug #74546 (SIGILL in ZEND_FETCH_CLASS_CONSTANT_SPEC_CONST_CONST).
+    (Laruence)
+
 - intl:
   . Fixed bug #74468 (wrong reflection on Collator::sortWithSortKeys). (villfa)
 
diff --git a/Zend/tests/bug74546.phpt b/Zend/tests/bug74546.phpt
new file mode 100644
index 0000000..9c1582a
--- /dev/null
+++ b/Zend/tests/bug74546.phpt
@@ -0,0 +1,11 @@
+--TEST--
+Bug #74546 (SIGILL in ZEND_FETCH_CLASS_CONSTANT_SPEC_CONST_CONST_HANDLER())
+--FILE--
+<?php 
+"000000"[0]::d;
+?>
+--EXPECTF--
+Fatal error: Uncaught Error: Class '0' not found in %sbug74546.php:%d
+Stack trace:
+#0 {main}
+  thrown in %sbug74546.php on line %d
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 9e0621d..7fe8815 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -6669,8 +6669,11 @@ void zend_compile_class_const(znode *result, zend_ast *ast) /* {{{ */
 		return;
 	}
 
-	zend_eval_const_expr(&class_ast);
-	zend_eval_const_expr(&const_ast);
+	zend_eval_const_expr(&ast->child[0]);
+	zend_eval_const_expr(&ast->child[1]);
+
+	class_ast = ast->child[0];
+	const_ast = ast->child[1];
 
 	if (class_ast->kind == ZEND_AST_ZVAL) {
 		resolved_name = zend_resolve_class_name_ast(class_ast);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.