]> granicus.if.org Git - php/commitdiff
Fixed bug #69755 (segfault in ZEND_CONCAT_SPEC_TMPVAR_CONST_HANDLER)
authorDmitry Stogov <dmitry@zend.com>
Thu, 4 Jun 2015 06:38:22 +0000 (09:38 +0300)
committerDmitry Stogov <dmitry@zend.com>
Thu, 4 Jun 2015 06:38:22 +0000 (09:38 +0300)
Zend/tests/bug69755.phpt [new file with mode: 0644]
Zend/zend_compile.c

diff --git a/Zend/tests/bug69755.phpt b/Zend/tests/bug69755.phpt
new file mode 100644 (file)
index 0000000..67c0ed3
--- /dev/null
@@ -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
index 0853dde10beb893f763cb37d4e78daa09836c66f..74dd4e1c179878150bd504b5bf8861927d1efab5 100644 (file)
@@ -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);
 }