summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Popov <nikic@php.net>2014-08-17 21:45:29 +0200
committerNikita Popov <nikic@php.net>2014-08-17 21:47:23 +0200
commit2a26cbb70e11c045cbb21966c1053e41b805d18f (patch)
treeab56a46f747f9dd5d6b2b191a45651429f593f96
parent1bab755a35ab7ffd5a551f7d9719f7045431dcd0 (diff)
downloadphp-git-2a26cbb70e11c045cbb21966c1053e41b805d18f.tar.gz
Fix dtor in do_free as well
We should expose zval_ptr_dtor_nogc outside zend_execute
-rw-r--r--Zend/zend_compile.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 59ccee1666..4a04862376 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -613,7 +613,13 @@ void zend_do_free(znode *op1 TSRMLS_DC) /* {{{ */
}
}
} else if (op1->op_type == IS_CONST) {
- zval_ptr_dtor(&op1->u.constant);
+ /* Destroy value without using GC: When opcache moves arrays into SHM it will
+ * free the zend_array structure, so references to it from outside the op array
+ * become invalid. GC would cause such a reference in the root buffer. */
+ zval *zv = &op1->u.constant;
+ if (Z_REFCOUNTED_P(zv) && !Z_DELREF_P(zv)) {
+ _zval_dtor_func_for_ptr(Z_COUNTED_P(zv) ZEND_FILE_LINE_CC);
+ }
}
}
/* }}} */