com php-src: Fix GC when opcache is in use: Zend/zend_ast.c

From: Date: Sun, 17 Aug 2014 17:15:54 +0000
Subject: com php-src: Fix GC when opcache is in use: Zend/zend_ast.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-80871@lists.php.net to get a copy of this message
Commit: 1bab755a35ab7ffd5a551f7d9719f7045431dcd0 Author: Nikita Popov <nikic@php.net> Sun, 17 Aug 2014 19:15:54 +0200 Parents: 84e757d22d437dcdaf5dfd08b69032240c69fb13 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=1bab755a35ab7ffd5a551f7d9719f7045431dcd0 Log: Fix GC when opcache is in use Changed paths: M Zend/zend_ast.c Diff: diff --git a/Zend/zend_ast.c b/Zend/zend_ast.c index d6995ef..eb35a51 100644 --- a/Zend/zend_ast.c +++ b/Zend/zend_ast.c @@ -370,10 +370,16 @@ static void zend_ast_destroy_ex(zend_ast *ast, zend_bool free) { switch (ast->kind) { case ZEND_AST_ZVAL: - zval_ptr_dtor(zend_ast_get_zval(ast)); - break; - case ZEND_AST_ZNODE: + { + /* 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 = zend_ast_get_zval(ast); + if (Z_REFCOUNTED_P(zv) && !Z_DELREF_P(zv)) { + _zval_dtor_func_for_ptr(Z_COUNTED_P(zv) ZEND_FILE_LINE_CC); + } break; + } case ZEND_AST_FUNC_DECL: case ZEND_AST_CLOSURE: case ZEND_AST_METHOD:

« previous php.cvs (#80871) next »