summaryrefslogtreecommitdiff
path: root/Zend/zend_opcode.c
diff options
context:
space:
mode:
authorXinchen Hui <laruence@gmail.com>2016-01-22 11:22:37 +0800
committerXinchen Hui <laruence@gmail.com>2016-01-22 11:22:37 +0800
commit9b61479166d8fa05f2fc2668d317cf21bd37354b (patch)
tree963491384979d88cf88084f2adc01de28429d751 /Zend/zend_opcode.c
parentaf255c67ebe4bdd0b990ab23310969817d05188d (diff)
downloadphp-git-9b61479166d8fa05f2fc2668d317cf21bd37354b.tar.gz
We don't need to dup zend_class_constant here.
quote why the internal class is still using duplication: ``` for internal classes, the zend_class_constant is malloc-ed. we need to free it. if (const->ce == ce) { zval_ptr_dtor(&const->value); free(const) } so, if two classes share one const, and it(parent class) was freed before, this read(in child class, const->ce) is invalid.. and destroy_zend_class is called via zend_hash_destroy(class_table). which is not in reverse order... so, parent classes are dtor first. if we want this work, we should change that order. ```
Diffstat (limited to 'Zend/zend_opcode.c')
-rw-r--r--Zend/zend_opcode.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c
index cff294854c..8b55037794 100644
--- a/Zend/zend_opcode.c
+++ b/Zend/zend_opcode.c
@@ -291,9 +291,11 @@ ZEND_API void destroy_zend_class(zval *zv)
zend_class_constant *c;
ZEND_HASH_FOREACH_PTR(&ce->constants_table, c) {
- zval_ptr_dtor(&c->value);
- if (c->doc_comment && c->ce == ce) {
- zend_string_release(c->doc_comment);
+ if (c->ce == ce) {
+ zval_ptr_dtor(&c->value);
+ if (c->doc_comment) {
+ zend_string_release(c->doc_comment);
+ }
}
} ZEND_HASH_FOREACH_END();
zend_hash_destroy(&ce->constants_table);