]> granicus.if.org Git - php/commitdiff
Prevent usage in GC after free.
authorDmitry Stogov <dmitry@zend.com>
Mon, 18 Apr 2016 22:31:49 +0000 (01:31 +0300)
committerDmitry Stogov <dmitry@zend.com>
Mon, 18 Apr 2016 22:31:49 +0000 (01:31 +0300)
Zend/zend_compile.c

index 2b35b4b6ef9ad7778896e30c79cee65dae70f181..b8aba65bcf3ee4faf9fa976a5905bb975d1eaea4 100644 (file)
@@ -3669,7 +3669,8 @@ static zend_bool do_inherit_property_access_check(HashTable *target_ht, zend_pro
                if ((child_info->flags & ZEND_ACC_PPP_MASK) > (parent_info->flags & ZEND_ACC_PPP_MASK)) {
                        zend_error_noreturn(E_COMPILE_ERROR, "Access level to %s::$%s must be %s (as in class %s)%s", ce->name, hash_key->arKey, zend_visibility_string(parent_info->flags), parent_ce->name, (parent_info->flags&ZEND_ACC_PUBLIC) ? "" : " or weaker");
                } else if ((child_info->flags & ZEND_ACC_STATIC) == 0) {
-                       zval_ptr_dtor(&(ce->default_properties_table[parent_info->offset]));
+                       /* Don't keep default properties in GC (thry may be freed by opcache) */
+                       i_zval_ptr_dtor_nogc(ce->default_properties_table[parent_info->offset] ZEND_FILE_LINE_CC TSRMLS_CC);
                        ce->default_properties_table[parent_info->offset] = ce->default_properties_table[child_info->offset];
                        ce->default_properties_table[child_info->offset] = NULL;
                        child_info->offset = parent_info->offset;