diff options
author | Dmitry Stogov <dmitry@zend.com> | 2017-10-30 23:13:10 +0300 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2017-10-30 23:13:10 +0300 |
commit | fcc08ce19f39f7ab1381ecc8a010037d41819329 (patch) | |
tree | c390b9b848758ad8e8b79b8f11e9a798a7de039d /Zend/zend_opcode.c | |
parent | dc4427d0caf2d066cd01f91fd0e899217fbceb30 (diff) | |
download | php-git-fcc08ce19f39f7ab1381ecc8a010037d41819329.tar.gz |
Prevent reference-counting on persistent zvals (internal constants, default properties and constants of internal classes).
New macro ZVAL_COPY_OR_DUP() is used perform duplication, if necessary.
This should eliminate related race-coditions in ZTS build and prevent reference-counting bugs after unclean shutdown.
Diffstat (limited to 'Zend/zend_opcode.c')
-rw-r--r-- | Zend/zend_opcode.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c index 7eafbc05e1..2382afbfb9 100644 --- a/Zend/zend_opcode.c +++ b/Zend/zend_opcode.c @@ -346,9 +346,12 @@ ZEND_API void destroy_zend_class(zval *zv) zend_class_constant *c; ZEND_HASH_FOREACH_PTR(&ce->constants_table, c) { - zval_internal_ptr_dtor(&c->value); - if (c->doc_comment && c->ce == ce) { - zend_string_release(c->doc_comment); + if (c->ce == ce) { + zval_internal_ptr_dtor(&c->value); + if (c->doc_comment) { + zend_string_release(c->doc_comment); + } + free(c); } } ZEND_HASH_FOREACH_END(); zend_hash_destroy(&ce->constants_table); |