com php-src: Fixed bug #69755 (segfault in ZEND_CONCAT_SPEC _TMPVAR_CONST_HANDLER): Zend/tests/bug6975 5.phpt Zend/zend_compile.c
| From: | Dmitry Stogov | Date: | Thu, 04 Jun 2015 06:38:22 +0000 |
| Subject: | com php-src: Fixed bug #69755 (segfault in ZEND_CONCAT_SPEC _TMPVAR_CONST_HANDLER): Zend/tests/bug6975 5.phpt Zend/zend_compile.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-87060@lists.php.net to get a copy of this message | ||
Commit: adb5f93f8514fc588a4d6740eaf1fea8b261bbb6
Author: Dmitry Stogov <dmitry@zend.com> Thu, 4 Jun 2015 09:38:22 +0300
Parents: 1d3f77d13d2b457bdf1bc52045da4679741e65cb
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=adb5f93f8514fc588a4d6740eaf1fea8b261bbb6
Log:
Fixed bug #69755 (segfault in ZEND_CONCAT_SPEC_TMPVAR_CONST_HANDLER)
Bugs:
https://bugs.php.net/69755
Changed paths:
A Zend/tests/bug69755.phpt
M Zend/zend_compile.c
Diff:
diff --git a/Zend/tests/bug69755.phpt b/Zend/tests/bug69755.phpt
new file mode 100644
index 0000000..67c0ed3
--- /dev/null
+++ b/Zend/tests/bug69755.phpt
@@ -0,0 +1,8 @@
+--TEST--
+Bug #69755: segfault in ZEND_CONCAT_SPEC_TMPVAR_CONST_HANDLER
+--FILE--
+<?php
+c . 10;
+?>
+--EXPECTF--
+Notice: Use of undefined constant c - assumed 'c' in %sbug69755.php on line 2
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 0853dde..74dd4e1 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -5722,6 +5722,15 @@ void zend_compile_binary_op(znode *result, zend_ast *ast) /* {{{ */
}
}
}
+ if (opcode == ZEND_CONCAT) {
+ /* convert constant operands to strings at compile-time */
+ if (left_node..op_type == IS_CONST) {
+ convert_to_string(&left_node.u.constant);
+ }
+ if (right_node.op_type == IS_CONST) {
+ convert_to_string(&right_node.u.constant);
+ }
+ }
zend_emit_op_tmp(result, opcode, &left_node, &right_node);
} while (0);
}