From adb5f93f8514fc588a4d6740eaf1fea8b261bbb6 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Thu, 4 Jun 2015 09:38:22 +0300 Subject: [PATCH] Fixed bug #69755 (segfault in ZEND_CONCAT_SPEC_TMPVAR_CONST_HANDLER) --- Zend/tests/bug69755.phpt | 8 ++++++++ Zend/zend_compile.c | 9 +++++++++ 2 files changed, 17 insertions(+) create mode 100644 Zend/tests/bug69755.phpt diff --git a/Zend/tests/bug69755.phpt b/Zend/tests/bug69755.phpt new file mode 100644 index 0000000000..67c0ed3383 --- /dev/null +++ b/Zend/tests/bug69755.phpt @@ -0,0 +1,8 @@ +--TEST-- +Bug #69755: segfault in ZEND_CONCAT_SPEC_TMPVAR_CONST_HANDLER +--FILE-- + +--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 0853dde10b..74dd4e1c17 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); } -- 2.40.0