com php-src: Fix dtor in do_free as well: Zend/zend _compile.c
| From: | Nikita Popov | Date: | Sun, 17 Aug 2014 19:47:23 +0000 |
| Subject: | com php-src: Fix dtor in do_free as well: Zend/zend _compile.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-80868@lists.php.net to get a copy of this message | ||
Commit: 2a26cbb70e11c045cbb21966c1053e41b805d18f
Author: Nikita Popov <nikic@php.net> Sun, 17 Aug 2014 21:45:29 +0200
Parents: 1bab755a35ab7ffd5a551f7d9719f7045431dcd0
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=2a26cbb70e11c045cbb21966c1053e41b805d18f
Log:
Fix dtor in do_free as well
We should expose zval_ptr_dtor_nogc outside zend_execute
Changed paths:
M Zend/zend_compile.c
Diff:
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 59ccee1..4a04862 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);
+ }
}
}
/* }}} */