summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-05-22 09:34:35 +0200
committerNikita Popov <nikita.ppv@gmail.com>2019-05-22 09:35:38 +0200
commitff4b0ce0e8d582e4b8f6c44270a77f511d28bacd (patch)
tree62590e7dcccfdffb7feb9f94584a43627b51c61a
parentd6c0c5ef8e90b26b8cf1632be1baa379405d0ba9 (diff)
downloadphp-git-ff4b0ce0e8d582e4b8f6c44270a77f511d28bacd.tar.gz
Fix bug #78034
Don't def non-cv variables in assign_obj_ref data operand.
-rw-r--r--ext/opcache/Optimizer/zend_dfg.c4
-rw-r--r--ext/opcache/tests/bug78034.phpt21
2 files changed, 23 insertions, 2 deletions
diff --git a/ext/opcache/Optimizer/zend_dfg.c b/ext/opcache/Optimizer/zend_dfg.c
index 00a7dba10c..a1104614f2 100644
--- a/ext/opcache/Optimizer/zend_dfg.c
+++ b/ext/opcache/Optimizer/zend_dfg.c
@@ -52,8 +52,8 @@ int zend_build_dfg(const zend_op_array *op_array, const zend_cfg *cfg, zend_dfg
if (next < end && next->opcode == ZEND_OP_DATA) {
if (next->op1_type & (IS_CV|IS_VAR|IS_TMP_VAR)) {
var_num = EX_VAR_TO_NUM(next->op1.var);
- if (opline->opcode == ZEND_ASSIGN_OBJ_REF
- || opline->opcode == ZEND_ASSIGN_STATIC_PROP_REF) {
+ if (next->op1_type == IS_CV && (opline->opcode == ZEND_ASSIGN_OBJ_REF
+ || opline->opcode == ZEND_ASSIGN_STATIC_PROP_REF)) {
DFG_SET(use, set_size, j, var_num);
DFG_SET(def, set_size, j, var_num);
} else {
diff --git a/ext/opcache/tests/bug78034.phpt b/ext/opcache/tests/bug78034.phpt
new file mode 100644
index 0000000000..ca9cd4ec07
--- /dev/null
+++ b/ext/opcache/tests/bug78034.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Bug #78034: "pecl" tool fails with abort assertion in zend_ssa.c
+--FILE--
+<?php
+
+function &ref() {}
+
+class Test {
+ function method($bool) {
+ if (!$bool) {
+ $this->foo = &ref();
+ }
+
+ $this->foo = &ref();
+ }
+}
+
+?>
+===DONE===
+--EXPECT--
+===DONE===